|
@@ -1,13 +1,13 @@
|
|
|
-'use strict'
|
|
|
-const path = require('path')
|
|
|
+'use strict';
|
|
|
+const path = require('path');
|
|
|
|
|
|
function resolve(dir) {
|
|
|
- return path.join(__dirname, dir)
|
|
|
+ return path.join(__dirname, dir);
|
|
|
}
|
|
|
|
|
|
-const name = '普定智慧停车大屏'
|
|
|
+const name = '普定智慧停车大屏';
|
|
|
|
|
|
-const port = 8080
|
|
|
+const port = 8080;
|
|
|
|
|
|
|
|
|
|
|
@@ -46,19 +46,19 @@ module.exports = {
|
|
|
'@': resolve('src')
|
|
|
},
|
|
|
fallback: {
|
|
|
- path: false,
|
|
|
+ path: false
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
chainWebpack(config) {
|
|
|
- config.plugins.delete('preload')
|
|
|
- config.plugins.delete('prefetch')
|
|
|
-
|
|
|
+ config.plugins.delete('preload');
|
|
|
+ config.plugins.delete('prefetch');
|
|
|
+ config.plugin('html').tap((args) => {
|
|
|
+ args[0].title = name;
|
|
|
+ return args;
|
|
|
+ });
|
|
|
|
|
|
- config.module
|
|
|
- .rule('svg')
|
|
|
- .exclude.add(resolve('src/assets/icons'))
|
|
|
- .end()
|
|
|
+ config.module.rule('svg').exclude.add(resolve('src/assets/icons')).end();
|
|
|
config.module
|
|
|
.rule('icons')
|
|
|
.test(/\.svg$/)
|
|
@@ -69,49 +69,47 @@ module.exports = {
|
|
|
.options({
|
|
|
symbolId: 'icon-[name]'
|
|
|
})
|
|
|
- .end()
|
|
|
+ .end();
|
|
|
|
|
|
- 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'),
|
|
|
+ config.when(process.env.NODE_ENV !== 'development', (config) => {
|
|
|
+ config
|
|
|
+ .plugin('ScriptExtHtmlWebpackPlugin')
|
|
|
+ .after('html')
|
|
|
+ .use('script-ext-html-webpack-plugin', [
|
|
|
{
|
|
|
- from: path.resolve(__dirname, './public/robots.txt'),
|
|
|
- to: './',
|
|
|
+
|
|
|
+ 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'),
|
|
|
+ {
|
|
|
+ from: path.resolve(__dirname, './public/robots.txt'),
|
|
|
+ to: './'
|
|
|
+ };
|
|
|
+ });
|
|
|
}
|
|
|
-}
|
|
|
+};
|