Artur Eshenbrener
Artur Eshenbrener

Reputation: 2020

Webpack: How to use prebuilt version of react and other libraries

How can I use provided by React prebuilt version of a library, instead build it on every webpack's run?

Upvotes: 2

Views: 418

Answers (1)

The module.noParse option works for this. You can set it up like this:

const PATHS = {
  react: path.join(__dirname, 'node_modules/react/dist/react.min.js')
};

module.exports = {
  module: {
    noParse: [
      PATHS.react
    ]
  },
  resolve: {
    alias: {
      react: PATHS.react
    }
  }
};

Source.

Upvotes: 2

Related Questions