This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
99 lines (92 loc) · 2.13 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
95
96
97
98
99
const path = require('path');
const webpack = require('webpack');
const webpackPlugins = [
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('./package.json').version),
}),
];
const fs = require('fs');
/**
* SSL cert file paths
* @type {{cert: string, key: string}}
*/
const ssl = {
key: './certs/localhost.key',
cert: './certs/localhost.crt',
};
/**
* Webpack dev server options
* @type {object}
*/
let devServer = {};
/**
* If ssl cert files exist, enable local https
*/
if (fs.existsSync(ssl.key)) {
devServer = {
https: {
key: fs.readFileSync(ssl.key),
cert: fs.readFileSync(ssl.cert),
},
public: 'https://localhost:8080/',
};
}
module.exports = {
devServer,
configureWebpack: {
resolve: {
alias: {
'@': path.resolve(__dirname, 'src/'),
'@api': path.resolve(__dirname, 'src/sdk/api'),
'@sdk': path.resolve(__dirname, 'src/sdk'),
'@components': path.resolve(__dirname, 'src/sdk/components'),
'@assets': path.resolve(__dirname, 'src/sdk/assets'),
'@styles': path.resolve(__dirname, 'src/styles'),
'@views': path.resolve(__dirname, 'src/views'),
'@static': path.resolve(__dirname, 'public'),
'@libs': path.resolve(__dirname, 'src/sdk/libs'),
'@classes': path.resolve(__dirname, 'src/classes'),
},
},
plugins: webpackPlugins,
devtool: 'source-map',
},
pluginOptions: {
i18n: {
locale: 'en',
fallbackLocale: 'en',
localeDir: 'sdk/translations',
enableInSFC: true,
},
svgSprite: {
dir: 'src/sdk/assets/icons',
test: /\.svg$/,
loaderOptions: {
extract: true,
spriteFilename: 'img/icons.svg',
},
},
prerenderSpa: {
registry: undefined,
renderRoutes: [
'/',
],
useRenderEvent: true,
headless: true,
onlyProduction: true,
},
},
css: {
loaderOptions: {
stylus: {
import: '~@styles/variables.styl',
},
},
},
chainWebpack: config => {
config.module
.rule('svg-sprite')
.use('svgo-loader')
.loader('svgo-loader');
},
};