forked from mazezen/websshterminal-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
61 lines (57 loc) · 2.01 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
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
const HtmlWebpackplugin = require('html-webpack-plugin')
// 防止缓存
const oDate = new Date();
const cacheTime = oDate.getFullYear() +''+ (oDate.getMonth()+1) +''+ oDate.getDate() +''+ ~~(Math.random()*100);
const pageScript = `<script>
if (window.name != 'bz${cacheTime}') {
location.href = location.origin + location.pathname + '?vtime=' + Date.now() + location.hash;
window.name = 'bz${cacheTime}'
}
</script>
`
module.exports = {
configureWebpack: config => {
config.plugins.push(AutoImport({
resolvers: [ElementPlusResolver({ importStyle: false })],
}))
config.plugins.push(Components({
resolvers: [ElementPlusResolver({ importStyle: false })],
}))
const miniCssExtractPlugin = config.plugins.find(
plugin => plugin.constructor.name === 'MiniCssExtractPlugin'
);
if (miniCssExtractPlugin) {
miniCssExtractPlugin.options.ignoreOrder = true;
}
if (process.env.NODE_ENV === 'production') {
config.mode = 'production';
// 打包文件大小配置
config.performance = {
maxEntrypointSize: 10000000,
maxAssetSize: 30000000
}
}
plugins: [
new HtmlWebpackplugin({
filename: 'index.html',
template: './public/index.html',
pageScript
})
]
},
css: {
loaderOptions: {
sass: {
// 8版本用prependData:
prependData:`
@import "@/assets/styles/variables.scss"; // scss文件地址
@import "@/assets/styles/mixin.scss"; // scss文件地址
@import "@/assets/css/uniformStyle.scss";
`
}
}
}
}