-
Notifications
You must be signed in to change notification settings - Fork 15
/
vue.config.js
65 lines (63 loc) · 1.89 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
let HtmlWebpackPlugin = require('html-webpack-plugin');
let HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');
var webpack = require('webpack');
// Lookup constants
const fs = require('fs');
const packageJson = fs.readFileSync('./package.json');
const parsed = JSON.parse(packageJson);
const version = parsed.version || 0;
const description = parsed.description || '';
const repository = parsed.repository.url || '';
const license = parsed.license || '';
const changelog = parsed.changelog || '';
const branch = parsed.branch || '';
const issues = parsed.issues || '';
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
transpileDependencies: [/(\/|\\)vuetify(\/|\\)/],
devServer: {
proxy: process.env.VUE_APP_API_URL
},
configureWebpack: {
devtool: 'source-map',
plugins: [
new webpack.DefinePlugin({
'process.env': {
PACKAGE_VERSION: '"' + version + '"',
DESCRIPTION: '"' + description + '"',
REPOSITORY: '"' + repository + '"',
LICENSE: '"' + license + '"',
CHANGELOG: '"' + changelog + '"',
BRANCH: '"' + branch + '"',
ISSUES: '"' + issues + '"'
}
}),
new HtmlWebpackPlugin({
template: 'public/index.html',
inlineSource: '.(js|css)$'
}),
new HtmlWebpackInlineSourcePlugin()
]
},
css: {
loaderOptions: {
sass: {
data: `@import "~@/sass/main.scss"`
}
}
},
chainWebpack: config => {
config.module
.rule('vue')
.use('vue-svg-inline-loader')
.loader('vue-svg-inline-loader')
.options();
['vue-modules', 'vue', 'normal-modules', 'normal'].forEach(match => {
config.module
.rule('scss')
.oneOf(match)
.use('sass-loader')
.tap(opt => Object.assign(opt, {data: `@import '~@/sass/main.scss';`}));
});
}
};