-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
90 lines (86 loc) · 2.09 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
const path = require('path')
const webpack = require('webpack')
module.exports = {
devServer: {
},
publicPath: process.env.NODE_ENV === 'production'
? '././'
: './',
configureWebpack: {
performance: {
hints: 'warning',
// 入口起点的最大体积
maxEntrypointSize: 50000000,
// 生成文件的最大体积
maxAssetSize: 30000000,
// 只给出 js 文件的性能提示
assetFilter: function (assetFilename) {
return assetFilename.endsWith('.js')
}
},
resolve: {
fallback: {
crypto: require.resolve('crypto-browserify'),
util: require.resolve('./node_modules/arweave/web/lib/utils.js'),
stream: require.resolve('stream-browserify')
}
},
plugins: [
new webpack.ProvidePlugin({
Buffer: [require.resolve('buffer/'), 'Buffer']
}),
new webpack.ProvidePlugin({
process: 'process/browser'
})
],
module: {
rules: [
{
test: /\.(svg)(\?.*)?$/,
use: [
{
loader: 'svg-sprite-loader',
options: {
limit: 10000,
name: 'assets/img/[name].[hash:7].[ext]',
symbolId: 'icon-[name]'
}
}
]
}
]
}
},
chainWebpack: config => {
config.module
.rule('svg')
.test(() => false)
.use('file-loader')
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('less').oneOf(type)))
},
pluginOptions: {
'style-resources-loader': {
preProcessor: 'less',
patterns: [
path.resolve('./src/style/theme.less')
]
},
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'locales',
enableInSFC: false
}
},
runtimeCompiler: true
}
function addStyleResource (rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [
path.resolve(__dirname, './src/themes/variables.less')
]
})
}