-
Notifications
You must be signed in to change notification settings - Fork 5
/
vue.config.js
55 lines (52 loc) · 1.61 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
const path = require('path')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
const HtmlWebpackPlugin = require('html-webpack-plugin')
const MomentLocalesPlugin = require('moment-locales-webpack-plugin')
const MomentTimezoneDataPlugin = require('moment-timezone-data-webpack-plugin')
const currentYear = new Date().getFullYear()
module.exports = {
transpileDependencies: ['buntpapier'],
configureWebpack: {
resolve: {
symlinks: false, // don't flatten symlinks (for npm link)
modules: [path.resolve('src'), path.resolve('src/styles'), 'node_modules']
},
plugins: [
new HtmlWebpackPlugin({
filename: 'demo.html',
minify: false,
inject: 'head',
template: 'public/demo.html'
}),
new MomentLocalesPlugin({ // 'en' is a part of moment and cannot be removed
localesToKeep: ['en-ie', 'ar', 'cs', 'de', 'el', 'es', 'fr', 'it', 'zh-tw', 'ja', 'pt-br'],
}),
new MomentTimezoneDataPlugin({
startYear: currentYear - 5,
endYear: currentYear + 5,
}),
]
},
chainWebpack (config) {
if (config.plugins.has('optimize-css')) {
config.plugin('optimize-css').tap(([options]) => {
options.cssnanoOptions.preset[1].calc = false
return [options]
})
}
},
css: {
loaderOptions: {
stylus: {
use: [require('buntpapier/stylus')({implicit: false})],
import: ['~buntpapier/buntpapier/index.styl', '~variables']
}
}
},
lintOnSave: true,
productionSourceMap: false
}
if (process.env.ANALYZE) {
console.log('building with bundle analyzer')
module.exports.configureWebpack.plugins.push(new BundleAnalyzerPlugin({analyzerMode: 'static'}))
}