-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
94 lines (86 loc) · 2.81 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
const app = require('./src/app.config')
/**
* Extend Vue & Webpack configuration.
* https://cli.vuejs.org/config/
*/
module.exports = {
productionSourceMap: false,
/**
* Pass some options to the PWA Plugin. See what is configured by default:
* https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
*/
pwa: {
name: app.name,
themeColor: app.themeColor,
msTileColor: app.backgroundColor,
appleMobileWebAppCapable: app.AppleMobileWebAppCapable,
appleMobileWebAppStatusBarStyle: app.AppleMobileWebAppStatusBarStyle
},
/**
* Pass settings to Pre-Processor loaders.
* https://cli.vuejs.org/guide/css.html#passing-options-to-pre-processor-loaders
*/
css: {
loaderOptions: {
sass: { data: `@import "@/styles/_settings.scss";` }
}
},
/**
* Tweak the webpack configuration.
* https://cli.vuejs.org/guide/webpack.html
*/
configureWebpack: config => {
// config.resolve.alias.appConfig = path.resolve(__dirname, './src')
if (process.env.NODE_ENV === 'production') {
// Remove comments inside compiled JS files.
config.optimization.minimizer[0].options.uglifyOptions.output.comments = false
}
},
// Allows for more fine-grained modification of the internal webpack config.
chainWebpack: config => {
// Inject app-specific variables into html-webpack-plugin
config.plugin('html').tap(args => {
args[0].app = app
return args
})
if (process.env.NODE_ENV === 'production') {
// Remove comments inside compiled CSS files.
config.plugin('optimize-css').tap(args => {
args[0].cssProcessorOptions = { discardComments: { removeAll: true } }
return args
})
.end()
// Let webpack generate all the project favicons and icons.
// https://github.com/jantimon/favicons-webpack-plugin
config.plugin('favicons').use(require('favicons-webpack-plugin'), [{
background: app.backgroundColor,
persistentCache: false,
inject: false,
logo: './public/img/icons/favicon.svg',
prefix: 'img/icons/',
icons: {
favicons: true,
android: true,
appleIcon: true,
windows: true,
appleStartup: false,
coast: false,
firefox: false,
yandex: false
}
}])
.end()
// Enhances 'html-webpack-plugin' with different deployment options for the scripts
// https://github.com/numical/script-ext-html-webpack-plugin
config.plugin('deferJS').use(require('script-ext-html-webpack-plugin'), [{
defaultAttribute: 'defer'
}])
.end()
} else {
// mutate for development...
}
},
// Configure Webpack's dev server (proxy API requests)
// https://github.com/vuejs/vue-cli/tree/dev/docs/config
devServer: {}
}