forked from NatLibFi/qvain-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
76 lines (69 loc) · 1.84 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
const path = require('path')
module.exports = {
lintOnSave: false,
assetsDir: "static",
chainWebpack: config => {
// make sure BABEL_ENV is set to whatever NODE_ENV is set to in .env files
if (process.env.BABEL_ENV !== process.env.NODE_ENV) {
process.env.BABEL_ENV = process.env.NODE_ENV
}
// set global vars
config
.plugin('define')
.tap(args => {
Object.assign(args[0], {
APP_DEBUG: JSON.stringify('zork'),
})
Object.assign(args[0]['process.env'], {
VUE_APP_MODE: JSON.stringify(process.env.VUE_CLI_MODE || process.env.NODE_ENV),
VUE_APP_VERSION: JSON.stringify(require('./package.json').version),
})
return args
})
// ignore old code in src/Attic/
config
.module
.rule('attic')
.exclude
.add(path.resolve(__dirname, 'src', 'Attic'))
.end()
// vue-cli minifies html by default for production; don't
if (process.env.NODE_ENV === 'production') {
config
.plugin('html')
.tap(([options]) => [Object.assign(options, {
minify: {
removeComments: true,
collapseWhitespace: false,
conservativeCollapse: false,
preserveLineBreaks: true,
removeAttributeQuotes: false,
},
})])
}
// configure public address for dev server so hot reloading can work with a proxy
if (process.env.APP_HOSTNAME) {
config.devServer.public(process.env.APP_HOSTNAME)
}
// watch needs to be in poll mode for it to work properly in Vagrant
// set watch options for dev server mode (e.g. npm run serve)
config.devServer.watchOptions({
poll: 1500,
ignored: [/node_modules/],
})
// set watch options for build mode with watch enabled (e.g. npm run watch)
config.watchOptions({
poll: 1500,
ignored: [/node_modules/],
})
},
css: {
loaderOptions: {
sass: {
data: `
@import "@/assets/css/_variables.scss";
`,
},
},
},
}