question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react.production.min.js is bundle with the library

See original GitHub issue

I’m testing out the component library in a project and when I run Webpack Analyzer, I see the the library itself has React bundled with it. I thought this was taken care of my putting it in the peerDependencies? I had also tried using the external key in the rollup config.

Screen Shot 2020-09-23 at 2 33 35 PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jeremypursercommented, Dec 3, 2020

@pneedham-mdsol Sure

const path = require('path')

module.exports = {
  //...
  resolve: {
    react: path.resolve(__dirname, '..', '..', 'node_modules/react')
    // Your path to React might be different
  }
};
0reactions
pneedham-mdsolcommented, Dec 3, 2020

@jeremypurser could you kindly share that Webpack config resolver? I believe I’m running into a similar issue (duplicate versions of React).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing Performance - React
Remember that only React files ending with .production.min.js are suitable for ... Finally, the resulting bundle is piped to terser for mangling (read...
Read more >
React Js - how to keep bundle.min.js small? - Stack Overflow
CommonsChunkPlugin will allow you to bundle libraries (or other chunks per your liking) to separate build files.
Read more >
Analyze your React app's bundle size and reduce it using ...
An app's bundle size is the amount of JavaScript a user will have to download to load your app. The bigger the bundle...
Read more >
Two Quick Ways To Reduce React App's Size In Production
If you are building a React + Redux App that has Webpack, then you might have noticed that the size of the final...
Read more >
How to package your React Component for distribution via NPM
I wrote a React component, transpiling using Babel, bundling and building using Webpack. I wanted to use it in another application via NPM....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found