loaders configured to accept files in node_modules may override alias
setting, including libraries multiple times
#2441
Labels
alias
setting, including libraries multiple times
#2441
The repro for this bug is a little involved, so I made a repo for it: https://github.com/seansfkelley/node-modules-alias-loader-bug
Summary: if you want to do local development across multiple repos with
npm link
and have a singleton specified in thealias
config block, this singleton can still be accidentally included multiple times if you have a loader configured to accept files fromnode_modules/
.Real-world example: I'm developing two React components from separate repos at the same time (say, cause one is consumed by the other). Each one was set up (i.e.,
npm install
ed) independently, but now they've been linked withnpm link
. React has to be a singleton on the page, otherwise it throws errors, but I have two copies of React in my module tree. To get around this, I specify analias
for React pointing to the parent module's instance. I also want to get source maps from the child project, so I bring insource-map-loader
and explicitly configure it to look for source maps innode_modules/
, as it is intended to do. Running Webpack will now include multiple instances of React.The text was updated successfully, but these errors were encountered: