How Prevent Multiple Copies Of React from Loading?

前端 未结 4 427
温柔的废话
温柔的废话 2020-12-16 13:26

In my previous Meteor app, using browserify, and React, all was working until I switched to meteor webpack.

I use react-select in my Meteor apps and it worked great

4条回答
  •  别那么骄傲
    2020-12-16 13:48

    In my case, I was building a separate npm module, then including that as a library in another project locally using npm link ../some-library. One of the modules within that library caused this error when I ran the parent project.

    When I ran into this error, the solution for me was to prevent react and react-dom from being including in the some-library bundle output, by adding the following to the module.exports of its webpack.config.js:

    externals: {
        react: 'react',
        'react-dom': 'react-dom'
    }
    

提交回复
热议问题