Skip to content

Commit eec961f

Browse files
committed
added alias for react and react dom so user won't face duplicated react problem
1 parent 1a4c8e9 commit eec961f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

config/webpack.prod.config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const path = require('path');
22
const CleanTerminalPlugin = require('clean-terminal-webpack-plugin');
3-
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
4-
5-
// TODO: code split the react icons library
3+
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
64

75
module.exports = {
86
mode: 'production',
@@ -16,6 +14,10 @@ module.exports = {
1614
resolve: {
1715
// our code can resolve 'xxx' instead of writing 'xxx.jsx'
1816
extensions: ['*', '.js', '.jsx', '.mjs'],
17+
alias: { // to prevent the multiple react problem
18+
react: path.resolve('./node_modules/react'),
19+
'react-dom': path.resolve('./node_modules/react-dom'),
20+
},
1921
},
2022
module: {
2123
// For every file that match regex in 'test', webpack pipes the code through to loaders

0 commit comments

Comments
 (0)