Fix react rhl misconfiguration

This commit is contained in:
SleepWalker 2019-12-30 09:42:02 +02:00
parent b3f1268950
commit af2f7cc532

View File

@ -3,17 +3,9 @@
const path = require('path'); const path = require('path');
const webpack = require('webpack'); const webpack = require('webpack');
const vendor = Object.keys(require('./packages/app/package.json').dependencies); const vendor = Object.keys(require('./packages/app/package.json').dependencies);
const baseConfig = require('./babel.config');
const isProduction = process.argv.some(arg => arg === '-p'); if (process.env.NODE_ENV === 'production') {
const isTest = process.argv.some(arg => arg.indexOf('karma') !== -1);
process.env.NODE_ENV = 'development';
if (isTest) {
process.env.NODE_ENV = 'test';
}
if (isProduction) {
throw new Error('Dll plugin should be used for dev mode only'); throw new Error('Dll plugin should be used for dev mode only');
} }
@ -23,7 +15,11 @@ const webpackConfig = {
mode: 'development', mode: 'development',
entry: { entry: {
vendor, vendor: vendor.filter(
item =>
// if we include rhl in dll. It won't work for some reason
!item.includes('react-hot-loader'),
),
}, },
output: { output: {
@ -33,10 +29,7 @@ const webpackConfig = {
publicPath: '/', publicPath: '/',
}, },
resolve: { resolve: baseConfig.resolve,
extensions: ['.js', '.jsx', '.json', '.ts', '.tsx'],
modules: ['./packages/app/node_modules', './node_modules'],
},
plugins: [ plugins: [
new webpack.DllPlugin({ new webpack.DllPlugin({