Open coreybruyere opened 5 years ago
the peerDependencies
are not installed by default. It just warns the requiring component that it needs that dependency to be installed by someone.
Now, if you want to have an external dependency not added on your bundle (this has nothing to do with peerDependencies
directly, btw), you can just tell webpack to do so. Add the configuration in the webpack.extra
on nwb.config.js
file. In the following snipped, i'm adding uniqid
to external dependencies:
module.exports = {
type: 'react-app',
webpack: {
extra: {
externals: 'uniqid',
},
},
};
In this case, you'll need to provide uniqid
some other way to the app, as a global variable in window.uniqid
. Maybe by using a umd
import?
This issue is a: Question / support request
I'm not familiar with NWB and came into a project that uses it. How do I exclude peer dependencies from being bundled? I need to ensure that a specific package doesn't make it through to the final build. Basically trying to configure using one of these items: https://www.styled-components.com/docs/faqs#removing-styledcomponents-from-your-library-bundle