forked from KNXCloud/lowcode-engine-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.plugin.js
48 lines (42 loc) · 1.08 KB
/
build.plugin.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
const HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = ({ onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.merge({
node: {
fs: 'empty',
},
});
config.module // fixes https://github.com/graphql/graphql-js/issues/1272
.rule('mjs$')
.test(/\.mjs$/)
.include.add(/node_modules/)
.end()
.type('javascript/auto');
config.merge({
entry: {
editor: require.resolve('./src/editor.ts'),
simulator: require.resolve('./src/vue/simulator.ts'),
},
});
config.plugin('editor').use(HtmlWebpackPlugin, [
{
inject: false,
template: require.resolve('./public/index.html'),
filename: 'index.html',
},
]);
config.plugin('preview').use(HtmlWebpackPlugin, [
{
inject: false,
template: require.resolve('./public/preview.html'),
filename: 'preview.html',
},
]);
config.resolve.merge({
alias: {
'@': path.resolve(__dirname, 'src'),
},
});
});
};