aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-tools-pages/webpack.config.js
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2019-01-10 00:54:55 +0800
commitfb3605026ef63ef6897010a52bf3f4c116cdf271 (patch)
treeaf3887e5f785e049daeaf795e0f3e4a9ad370d93 /packages/dev-tools-pages/webpack.config.js
parent76dde294f10bb3d5c1074cd6599668bcb1cdd8ec (diff)
parent5b8c9122a292f6558c45440b053ceae52d36d495 (diff)
downloaddexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.gz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.bz2
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.lz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.xz
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.zst
dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.zip
Merge branch 'development' into feature/instant/tell-amount-available
Diffstat (limited to 'packages/dev-tools-pages/webpack.config.js')
-rw-r--r--packages/dev-tools-pages/webpack.config.js38
1 files changed, 34 insertions, 4 deletions
diff --git a/packages/dev-tools-pages/webpack.config.js b/packages/dev-tools-pages/webpack.config.js
index 6dfcf74e7..640297770 100644
--- a/packages/dev-tools-pages/webpack.config.js
+++ b/packages/dev-tools-pages/webpack.config.js
@@ -1,13 +1,24 @@
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
+const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
+const HtmlWebpackPlugin = require('html-webpack-plugin');
const childProcess = require('child_process');
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+const CleanWebpackPlugin = require('clean-webpack-plugin');
+
+const pages = require('./pages');
const config = {
- entry: ['./ts/index.tsx'],
+ entry: {
+ compiler: './ts/pages/compiler.tsx',
+ cov: './ts/pages/cov.tsx',
+ profiler: './ts/pages/profiler.tsx',
+ trace: './ts/pages/trace.tsx',
+ },
output: {
path: path.join(__dirname, '/public'),
- filename: 'bundle.js',
+ filename: 'bundle-[name].js',
chunkFilename: 'bundle-[name].js',
publicPath: '/',
},
@@ -48,6 +59,10 @@ const config = {
test: /\.css$/,
loaders: ['style-loader', 'css-loader'],
},
+ {
+ test: /\.svg$/,
+ loaders: ['react-svg-loader'],
+ },
],
},
optimization: {
@@ -60,21 +75,36 @@ const config = {
devServer: {
port: 3572,
disableHostCheck: true,
+ overlay: true,
+ historyApiFallback: true,
},
};
module.exports = (_env, argv) => {
- let plugins = [];
+ let plugins = [
+ new CleanWebpackPlugin('public'),
+ ...pages.map(p => new HtmlWebpackPlugin(p)),
+ new CopyWebpackPlugin([
+ { from: 'assets/crawl.html', to: 'index.html' },
+ { from: 'assets/fonts', to: 'fonts' },
+ { from: 'assets/images', to: 'images' },
+ ]),
+ ];
if (argv.mode === 'development') {
config.mode = 'development';
} else {
config.mode = 'production';
+ config.output.filename = 'bundle-[name].[chunkhash].js';
+ config.output.chunkFilename = 'bundle-[name].[chunkhash].js';
+
plugins = plugins.concat([
new webpack.DefinePlugin({
'process.env': {
- NODE_ENV: JSON.stringify(process.env.NODE_ENV),
+ NODE_ENV: JSON.stringify(process.env.NODE_ENV || config.mode),
},
}),
+ // commented out to check the bundle when needed
+ //new BundleAnalyzerPlugin(),
]);
}
console.log('i 「atl」: Mode: ', config.mode);