How Prevent Multiple Copies Of React from Loading?

前端 未结 4 430
温柔的废话
温柔的废话 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条回答
  •  猫巷女王i
    2020-12-16 13:58

    Since you use webpack, you can add an alias for loading react, like this:

    // In webpack.config.js
    
      resolve: {
        alias: {
          react: path.resolve('node_modules/react'),
        },
      },
    

    This prevented the addComponentAsRefTo(...) error and made our build succeed again. However, for some reason, the testing build failed only on our CI environment as it could not resolve the node_modules/react path. I think it's unlikely that you will encounter this particular problem, though.

提交回复
热议问题