|
@@ -13,7 +13,7 @@ const name = defaultSettings.title || 'vue Admin Template'
|
|
|
|
|
|
|
|
|
|
|
|
-const port = process.env.port || process.env.npm_config_port || 9528
|
|
|
+const port = process.env.port || process.env.npm_config_port || 8081
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
@@ -36,7 +36,18 @@ module.exports = {
|
|
|
warnings: false,
|
|
|
errors: true
|
|
|
},
|
|
|
- before: require('./mock/mock-server.js')
|
|
|
+ proxy: {
|
|
|
+
|
|
|
+ '/api': {
|
|
|
+ target: 'http://127.0.0.1:8082/',
|
|
|
+ changeOrigin: true,
|
|
|
+ ws: true,
|
|
|
+ pathRewrite: {
|
|
|
+ '^/api': ''
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
configureWebpack: {
|
|
|
|
|
@@ -64,10 +75,7 @@ module.exports = {
|
|
|
config.plugins.delete('prefetch')
|
|
|
|
|
|
|
|
|
- config.module
|
|
|
- .rule('svg')
|
|
|
- .exclude.add(resolve('src/icons'))
|
|
|
- .end()
|
|
|
+ config.module.rule('svg').exclude.add(resolve('src/icons')).end()
|
|
|
config.module
|
|
|
.rule('icons')
|
|
|
.test(/\.svg$/)
|
|
@@ -80,44 +88,42 @@ module.exports = {
|
|
|
})
|
|
|
.end()
|
|
|
|
|
|
- config
|
|
|
- .when(process.env.NODE_ENV !== 'development',
|
|
|
- config => {
|
|
|
- config
|
|
|
- .plugin('ScriptExtHtmlWebpackPlugin')
|
|
|
- .after('html')
|
|
|
- .use('script-ext-html-webpack-plugin', [{
|
|
|
+ config.when(process.env.NODE_ENV !== 'development', (config) => {
|
|
|
+ config
|
|
|
+ .plugin('ScriptExtHtmlWebpackPlugin')
|
|
|
+ .after('html')
|
|
|
+ .use('script-ext-html-webpack-plugin', [
|
|
|
+ {
|
|
|
|
|
|
- inline: /runtime\..*\.js$/
|
|
|
- }])
|
|
|
- .end()
|
|
|
- config
|
|
|
- .optimization.splitChunks({
|
|
|
- chunks: 'all',
|
|
|
- cacheGroups: {
|
|
|
- libs: {
|
|
|
- name: 'chunk-libs',
|
|
|
- test: /[\\/]node_modules[\\/]/,
|
|
|
- priority: 10,
|
|
|
- chunks: 'initial'
|
|
|
- },
|
|
|
- elementUI: {
|
|
|
- name: 'chunk-elementUI',
|
|
|
- priority: 20,
|
|
|
- test: /[\\/]node_modules[\\/]_?element-ui(.*)/
|
|
|
- },
|
|
|
- commons: {
|
|
|
- name: 'chunk-commons',
|
|
|
- test: resolve('src/components'),
|
|
|
- minChunks: 3,
|
|
|
- priority: 5,
|
|
|
- reuseExistingChunk: true
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- config.optimization.runtimeChunk('single')
|
|
|
+ inline: /runtime\..*\.js$/
|
|
|
+ }
|
|
|
+ ])
|
|
|
+ .end()
|
|
|
+ config.optimization.splitChunks({
|
|
|
+ chunks: 'all',
|
|
|
+ cacheGroups: {
|
|
|
+ libs: {
|
|
|
+ name: 'chunk-libs',
|
|
|
+ test: /[\\/]node_modules[\\/]/,
|
|
|
+ priority: 10,
|
|
|
+ chunks: 'initial'
|
|
|
+ },
|
|
|
+ elementUI: {
|
|
|
+ name: 'chunk-elementUI',
|
|
|
+ priority: 20,
|
|
|
+ test: /[\\/]node_modules[\\/]_?element-ui(.*)/
|
|
|
+ },
|
|
|
+ commons: {
|
|
|
+ name: 'chunk-commons',
|
|
|
+ test: resolve('src/components'),
|
|
|
+ minChunks: 3,
|
|
|
+ priority: 5,
|
|
|
+ reuseExistingChunk: true
|
|
|
+ }
|
|
|
}
|
|
|
- )
|
|
|
+ })
|
|
|
+
|
|
|
+ config.optimization.runtimeChunk('single')
|
|
|
+ })
|
|
|
}
|
|
|
}
|