-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
97 lines (97 loc) · 2.79 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
const path = require('path')
module.exports = {
publicPath: '/',
// output file directory
outputDir: 'dist',
assetsDir: 'assets',
lintOnSave: false,
pluginOptions: {
sitemap: {
urls: [
'https://pletenyikit.com/',
'https://pletenyikit.com/toys',
'https://pletenyikit.com/accessories',
'https://pletenyikit.com/pillows',
'https://pletenyikit.com/kitchen',
'https://pletenyikit.com/order'
],
defaults: {
lastmod: '2021-11-14',
changefreq: 'daily',
priority: 1.0,
},
}
},
filenameHashing: false,
chainWebpack: (config) => {
config.resolve.symlinks (true) // hot update
},
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// modify the configuration for the production environment ...
config.mode = 'production'
// Each dependencies packaged into separate files js
let optimization = {
runtimeChunk: 'single',
splitChunks: {
chunks: 'all',
maxInitialRequests: Infinity,
minSize: 20000,
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name(module) {
const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1]
return `npm.${packageName.replace('@', '')}`
}
}
}
}
}
Object.assign(config, {
optimization
})
} else {
// modify the configuration for the development environment ...
config.mode = 'development'
}
Object.assign(config, {
// development and production of common configuration
resolve: {
extensions: [ '.js', '.vue', '.json'], // requesting the local json
alias: {
'@': path.resolve(__dirname, './src'),
'@c': path.resolve(__dirname, './src/components'),
'@p': path.resolve(__dirname, './src/pages')
} // Alias Configuration
}
})
},
// production environment is generated sourceMap file
productionSourceMap: true,
css: {
// whether to use css separate plug-ExtractTextPlugin
extract: true,
// open the CSS source maps? Whether in building style maps, false will increase build speed
sourceMap: false,
// css preset configuration items
loaderOptions: {}
},
parallel: require('os').cpus().length > 1,
// webpack-dev-server configuration
devServer: {
open: process.platform === 'darwin',
host: '0.0.0.0',
port: 8080,
https: false,
proxy: {
'/api': {
target: 'http://localhost:3000/',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},
}
}