Open Dongd0825 opened 5 years ago
hello everyone, i have a question that i imort react and set externals, but also has error import React from 'react' import ReactDom from 'react-dom'
new HtmlWebpackExternalsPlugin({ externals: [{ module: 'react', entry: 'https://11.url.cn/now/lib/16.2.0/react.min.js', global: 'React', }, { module: 'react-dom', entry: 'https://11.url.cn/now/lib/16.2.0/react-dom.min.js', global: 'ReactDom', }], })
but also console error
external "ReactDom":1 Uncaught ReferenceError: ReactDom is not defined at Object. (external "ReactDom":1) at n (bootstrap:19) at Module. (index.js:89) at n (bootstrap:19) at bootstrap:83 at bootstrap:83
Change global: 'ReactDom' to global: 'ReactDOM'. The compiled version of react-dom exports a global object called ReactDOM.
global: 'ReactDom'
global: 'ReactDOM'
ReactDOM
You can continue to import it as ReactDom.
ReactDom
hello everyone, i have a question that i imort react and set externals, but also has error import React from 'react' import ReactDom from 'react-dom'
new HtmlWebpackExternalsPlugin({ externals: [{ module: 'react', entry: 'https://11.url.cn/now/lib/16.2.0/react.min.js', global: 'React', }, { module: 'react-dom', entry: 'https://11.url.cn/now/lib/16.2.0/react-dom.min.js', global: 'ReactDom', }], })
but also console error
external "ReactDom":1 Uncaught ReferenceError: ReactDom is not defined at Object. (external "ReactDom":1)
at n (bootstrap:19)
at Module. (index.js:89)
at n (bootstrap:19)
at bootstrap:83
at bootstrap:83