style:监管问题修改
Showing
2 changed files
with
13 additions
and
10 deletions
1 | 'use strict' | 1 | 'use strict' |
2 | const path = require('path') | 2 | const path = require('path') |
3 | const defaultSettings = require('./src/settings.js') | ||
4 | |||
3 | function resolve (dir) { | 5 | function resolve (dir) { |
4 | return path.join(__dirname, dir) | 6 | return path.join(__dirname, dir) |
5 | } | 7 | } |
6 | const name = process.env.TITLE | 8 | |
7 | const port = process.env.port || process.env.npm_config_port || 8888 // dev port | 9 | const port = process.env.port || process.env.npm_config_port || 8888 // dev port |
10 | |||
8 | // All configuration item explanations can be find in https://cli.vuejs.org/config/ | 11 | // All configuration item explanations can be find in https://cli.vuejs.org/config/ |
9 | module.exports = { | 12 | module.exports = { |
10 | /** | 13 | /** |
... | @@ -45,7 +48,7 @@ module.exports = { | ... | @@ -45,7 +48,7 @@ module.exports = { |
45 | } | 48 | } |
46 | }, | 49 | }, |
47 | css: { | 50 | css: { |
48 | extract: false, // 是否使用css分离插件 ExtractTextPlugin | 51 | extract: true, // 是否使用css分离插件 ExtractTextPlugin |
49 | sourceMap: false, // 开启 CSS source maps? | 52 | sourceMap: false, // 开启 CSS source maps? |
50 | loaderOptions: { | 53 | loaderOptions: { |
51 | sass: { | 54 | sass: { |
... | @@ -56,21 +59,22 @@ module.exports = { | ... | @@ -56,21 +59,22 @@ module.exports = { |
56 | }, | 59 | }, |
57 | // configureWebpack通过操作对象的形式,来修改默认的webpack配置 | 60 | // configureWebpack通过操作对象的形式,来修改默认的webpack配置 |
58 | configureWebpack: { | 61 | configureWebpack: { |
59 | name: name, | 62 | optimization: { |
60 | externals: [{ | 63 | usedExports: true, |
61 | './cptable': 'var cptable' | 64 | minimize: true |
62 | }], | 65 | }, |
66 | entry: { | ||
67 | app: './src/main.js' | ||
68 | }, | ||
63 | resolve: { | 69 | resolve: { |
64 | alias: { | 70 | alias: { |
65 | '@': resolve('src') | 71 | '@': resolve('src') |
66 | } | 72 | } |
67 | }, | 73 | }, |
68 | devtool: '#eval-source-map' //测试 | 74 | devtool: process.env.NODE_ENV === 'development' ? '#eval-source-map' : false |
69 | }, | 75 | }, |
70 | // chainWebpack通过链式编程的形式,来修改默认的webpack配置 | 76 | // chainWebpack通过链式编程的形式,来修改默认的webpack配置 |
71 | chainWebpack (config) { | 77 | chainWebpack (config) { |
72 | config.entry.app = ['babel-polyfill', './src/main.js']; | ||
73 | // it can improve the speed of the first screen, it is recommended to turn on preload | ||
74 | // it can improve the speed of the first screen, it is recommended to turn on preload | 78 | // it can improve the speed of the first screen, it is recommended to turn on preload |
75 | config.plugin('preload').tap(() => [ | 79 | config.plugin('preload').tap(() => [ |
76 | { | 80 | { |
... | @@ -81,7 +85,6 @@ module.exports = { | ... | @@ -81,7 +85,6 @@ module.exports = { |
81 | include: 'initial' | 85 | include: 'initial' |
82 | } | 86 | } |
83 | ]) | 87 | ]) |
84 | |||
85 | // when there are many pages, it will cause too many meaningscss requests | 88 | // when there are many pages, it will cause too many meaningscss requests |
86 | config.plugins.delete('prefetch') | 89 | config.plugins.delete('prefetch') |
87 | config.module | 90 | config.module | ... | ... |
-
Please register or sign in to post a comment