-
Notifications
You must be signed in to change notification settings - Fork 2
/
vue.config.js
57 lines (55 loc) · 1.44 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
const siteConfig = require('./site.config.json');
const path = require('path')
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin')
siteConfig['BASE_URL'] = process.env.BASE_URL
module.exports = {
chainWebpack: config => {
// Rule for `.vue` files
config.module
.rule('vue')
.use('vue-loader')
.loader('vue-loader')
.tap(options => options);
// Rule for `js` files inside `src`
config.module
.rule('js')
.test(/\.js$/)
.include.add(path.resolve(__dirname, 'src'))
.end()
.use('babel-loader')
.loader('babel-loader');
// Rule for `hypha-rpc` package in `node_modules` with optional chaining plugin
config.module
.rule('hypha-rpc')
.test(/\.js$/)
.include.add(/node_modules\/hypha-rpc/)
.end()
.use('babel-loader')
.loader('babel-loader')
.tap(options => ({
...options,
plugins: ["@babel/plugin-proposal-optional-chaining"],
}));
},
publicPath: '/',
pwa: {
workboxPluginMode: 'GenerateSW',
workboxOptions: {
skipWaiting: true
}
},
configureWebpack: {
plugins: [
new HtmlWebpackPlugin({
templateParameters: siteConfig,
template : './public/index.ejs'
}),
new CopyWebpackPlugin([{
from: path.join(__dirname, "docs"),
to: path.join(__dirname, "dist/docs"),
toType: "dir"
}])
]
}
}