From f2c7607638c961253e05c61b7b3dce599270a09f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 22 Apr 2019 22:19:58 -0400 Subject: [PATCH] [change] local webpack won't use built css file --- index.dev.html | 53 +++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- webpack.config.babel.js | 39 +++++++++++++++++------------- 3 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 index.dev.html diff --git a/index.dev.html b/index.dev.html new file mode 100644 index 0000000..91c4f41 --- /dev/null +++ b/index.dev.html @@ -0,0 +1,53 @@ + + + + + + Chaotic Backup + + + + + + + + + + + +
+ + + diff --git a/package.json b/package.json index 91f8b60..79043ba 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.0.0", "description": "Chaotic Backup", "scripts": { - "start": "webpack-dev-server -d --inline --host 0.0.0.0 --history-api-fallback", + "start": "webpack-dev-server -d --inline", "build": "webpack -p" }, "repository": { diff --git a/webpack.config.babel.js b/webpack.config.babel.js index 8a5cfb7..b84a93f 100644 --- a/webpack.config.babel.js +++ b/webpack.config.babel.js @@ -10,6 +10,13 @@ const devMode = (process.env.NODE_ENV !== 'production' && process.argv.indexOf(' const config = { entry: ['@babel/polyfill', `${__dirname}/src/components/index.js`], + devServer: { + host: '0.0.0.0', + historyApiFallback: { + index: 'index.dev.html', + }, + }, + output: { path: `${__dirname}/build`, publicPath: '/build/', @@ -22,9 +29,9 @@ const config = { cache: true, parallel: true, sourceMap: true, - extractComments: true + extractComments: true, }), - new OptimizeCSSAssetsPlugin({}) + new OptimizeCSSAssetsPlugin({}), ], splitChunks: { cacheGroups: { @@ -32,30 +39,30 @@ const config = { name: 'styles', test: /\.css$/, chunks: 'all', - enforce: true - } - } - } + enforce: true, + }, + }, + }, }, module: { rules: [ { - test: /\.(js|jsx)$/, + test: /\.(js|jsx)$/, exclude: /node_modules/, loader: 'babel-loader', options: { - 'presets': [ + presets: [ '@babel/preset-env', '@babel/preset-react', '@babel/preset-flow', ], - 'plugins': [ + plugins: [ '@babel/plugin-transform-runtime', - ['@babel/plugin-proposal-decorators', {'legacy': true }], - ['@babel/plugin-proposal-class-properties', { 'loose': true }] - ] - } + ['@babel/plugin-proposal-decorators', {legacy: true }], + ['@babel/plugin-proposal-class-properties', { loose: true }], + ], + }, }, { test: /\.s?[ac]ss$/, @@ -64,8 +71,8 @@ const config = { 'css-loader', 'sass-loader', ], - } - ] + }, + ], }, resolve: { @@ -84,7 +91,7 @@ const config = { new MiniCssExtractPlugin({ filename: '[name].css', chunkFilename: '[id].css', - }) + }), ], };