-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathbuild.plugin.js
39 lines (33 loc) · 965 Bytes
/
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
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = ({ onGetWebpackConfig }) => {
onGetWebpackConfig((config) => {
config.resolve.plugin('tsconfigpaths').use(TsconfigPathsPlugin, [
{
configFile: './tsconfig.json',
},
]);
config.merge({
entry: {
index: require.resolve('./src/demo/index.tsx'),
},
});
config.plugin('index').use(HtmlWebpackPlugin, [
{
inject: false,
templateParameters: {},
template: require.resolve('./public/index.html'),
filename: 'index.html',
},
]);
config.plugins.delete('hot');
config.devServer.hot(false);
config.module // fixes https://github.com/graphql/graphql-js/issues/1272
.rule('mjs$')
.test(/\.mjs$/)
.include
.add(/node_modules/)
.end()
.type('javascript/auto');
});
};