-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
39 lines (34 loc) · 946 Bytes
/
server.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 Webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
const webpackConfig = require('./webpack.config.js');
const WebpackDevServer = require('webpack-dev-server');
const WorkboxPlugin = require('workbox-webpack-plugin');
/**
* Workaround to the issue:
* https://github.com/GoogleChrome/workbox/issues/1790
*/
webpackConfig.plugins = webpackConfig.plugins.filter(plugin => !(plugin instanceof WorkboxPlugin.GenerateSW));
webpackConfig.plugins.push(
new CopyPlugin({
patterns: [{ from: './src/service-worker.js' }]
})
);
const compiler = Webpack({
...webpackConfig,
performance: {
maxAssetSize: 500_000,
maxEntrypointSize: 500_000,
},
cache: true,
watch: true,
mode: 'development',
});
const server = new WebpackDevServer({
open: true,
compress: true,
}, compiler);
const runServer = async () => {
console.log('Starting server...');
await server.start();
};
runServer();