Skip to content

Commit

Permalink
fix: 🐛 Handled global React as aliases instead
Browse files Browse the repository at this point in the history
  • Loading branch information
CPatchane committed Nov 12, 2018
1 parent 3f6ef8b commit 42a9224
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 15 deletions.
1 change: 1 addition & 0 deletions config/aliases/globalReact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = window.React || require('react-bundled')
1 change: 1 addition & 0 deletions config/aliases/globalReactDOM.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = window.ReactDOM || require('react-dom-bundled')
9 changes: 7 additions & 2 deletions config/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const SRC_DIR = path.resolve(__dirname, '../src')
module.exports = {
entry: [
// Check for global React or load dependency
path.resolve(__dirname, '../src/prepareReact.js'),
path.resolve(__dirname, '../src/index')
],
output: {
Expand All @@ -19,7 +18,13 @@ module.exports = {
},
resolve: {
extensions: ['.js', '.json', '.yaml'],
modules: [SRC_DIR, path.join(__dirname, '../node_modules')]
modules: [SRC_DIR, path.join(__dirname, '../node_modules')],
alias: {
react: path.resolve(__dirname, 'aliases/globalReact'),
'react-dom': path.resolve(__dirname, 'aliases/globalReactDOM'),
'react-bundled': 'react',
'react-dom-bundled': 'react-dom'
}
},
devtool: '#source-map',
module: {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@
"yaml"
],
"setupFiles": [
"<rootDir>/test/jestLib/setup.js",
"<rootDir>/src/prepareReact.js"
"<rootDir>/test/jestLib/setup.js"
],
"moduleDirectories": [
"node_modules",
Expand Down
11 changes: 0 additions & 11 deletions src/prepareReact.js

This file was deleted.

0 comments on commit 42a9224

Please sign in to comment.