soiz1 commited on
Commit
72af047
·
verified ·
1 Parent(s): f711c43

Update webpack.config.js

Browse files
Files changed (1) hide show
  1. webpack.config.js +25 -24
webpack.config.js CHANGED
@@ -31,33 +31,34 @@ const htmlWebpackPluginCommon = {
31
  const base = {
32
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
33
  devtool: process.env.SOURCEMAP ? process.env.SOURCEMAP : process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
34
- devServer: {
35
- contentBase: path.resolve(__dirname, 'build'),
36
- host: '0.0.0.0',
37
- compress: true,
38
- port: process.env.PORT || 8601,
39
- // allows ROUTING_STYLE=wildcard to work properly
40
- historyApiFallback: {
41
- rewrites: [
42
- { from: /^\/\d+\/?$/, to: '/index.html' },
43
- { from: /^\/\d+\/fullscreen\/?$/, to: '/fullscreen.html' },
44
- { from: /^\/\d+\/editor\/?$/, to: '/editor.html' },
45
- { from: /^\/\d+\/playground\/?$/, to: '/playground.html' },
46
- { from: /^\/\d+\/embed\/?$/, to: '/embed.html' },
47
- { from: /^\/addons\/?$/, to: '/addons.html' }
48
- ]
49
- },
50
- setupMiddlewares(middlewares, devServer) {
51
- devServer.app.get('/stats.json', (req, res) => {
52
- const stats = devServer.stats.toJson({
 
53
  all: false,
54
  assets: true
55
- });
56
- res.json(stats);
57
  });
58
- return middlewares;
59
- }
60
- },
 
 
61
  output: {
62
  library: 'GUI',
63
  filename: process.env.NODE_ENV === 'production' ? 'js/[name].[contenthash].js' : 'js/[name].js',
 
31
  const base = {
32
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
33
  devtool: process.env.SOURCEMAP ? process.env.SOURCEMAP : process.env.NODE_ENV === 'production' ? false : 'cheap-module-source-map',
34
+ devServer: {
35
+ static: {
36
+ directory: path.resolve(__dirname, 'build')
37
+ },
38
+ host: '0.0.0.0',
39
+ compress: true,
40
+ port: process.env.PORT || 8601,
41
+ historyApiFallback: {
42
+ rewrites: [
43
+ { from: /^\/\d+\/?$/, to: '/index.html' },
44
+ { from: /^\/\d+\/fullscreen\/?$/, to: '/fullscreen.html' },
45
+ { from: /^\/\d+\/editor\/?$/, to: '/editor.html' },
46
+ { from: /^\/\d+\/playground\/?$/, to: '/playground.html' },
47
+ { from: /^\/\d+\/embed\/?$/, to: '/embed.html' },
48
+ { from: /^\/addons\/?$/, to: '/addons.html' }
49
+ ]
50
+ },
51
+ setupMiddlewares(middlewares, devServer) {
52
+ devServer.app.get('/stats.json', (req, res) => {
53
+ const stats = devServer.stats.toJson({
54
  all: false,
55
  assets: true
 
 
56
  });
57
+ res.json(stats);
58
+ });
59
+ return middlewares;
60
+ }
61
+ },
62
  output: {
63
  library: 'GUI',
64
  filename: process.env.NODE_ENV === 'production' ? 'js/[name].[contenthash].js' : 'js/[name].js',