Webpack on the Packaging of react components

desired effect

the react components developed by ourselves do not want to introduce react, when they are packaged, but want to introduce react externally

.

clipboard.png

react

webpack.config.js

clipboard.png

clipboard.png
report that react is not defined

so the above react does not refer to the global.

complete project address

https://github.com/951565664/. testExternals branch


1, try 'react':' window.React'
2, and make sure that the react.js file loads


before the packaged js file in html. I didn't change anything. For the time being, this question has been turned off

.
Menu