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.

Duplicate id for the same dependency

See original GitHub issue

I’m playing with Browserify and React today and in my bundle I’m noticing that React is loaded with 2 different dependency number. One is 158 and the other is 314.

In the bundle file, I can see this for 314

314:[function(require,module,exports){
arguments[4][158][0].apply(exports,arguments)
},{"./lib/React":187,"dup":158}]

158 is basically just a shortcut for module.exports = require('./lib/React'); which is 187.

My code is broken because of that, because it loads the dependency twice.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
leftmostcatcommented, Apr 25, 2015

I’m experiencing a similar issue with a module attempting to inject itself into jquery. Removing the duplicate jquery from the module’s node_modules/ directory solved the problem. That said, it seems like browserify recognizes that the packages are duplicated. Why couldn’t it (in the above instance) simply give 158 to the second package require()ing React instead of creating 314 to de-duplicate it?

0reactions
giggiocommented, Jul 20, 2015

@chrisirhc It makes no sense that I should have to manually enter the node_modules directory to symlink directories. When you npm install npm resolves the dependencies itself, I should not have to go and manually change things. An example are the jquery plugins. Imagine you install 2 different jquery plugins, each jquery plugin might attach itself to a different jquery instance. This is exactly what you do not expect. This gets even worse as npm and jquery are saying that browserify is the way to go for these plugins, but this setup will simply not work if you use more than one plugin. Until I found browserify-resolutions browserify made itself unusable. This is critical and I am appalled that this issue was closed and letting this go on like that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I get a maven build to fail on duplicate dependencies?
What this rule does is checking that there are no 2 duplicate declaration with the same 'dependencies.dependency.(groupId:artifactId:type: ...
Read more >
Remove Duplicate Dependencies with Maven - Baeldung
Learn how to detect duplicate dependencies in Maven using the mvn dependency:tree and mvn dependency:analyze-duplicate commands.
Read more >
Ban Duplicate Pom Dependency Versions - Apache Maven
Ban Duplicate Pom Dependency Versions. This rule checks that there are no duplicate dependencies declared in the POM of the project.
Read more >
Detecting duplicate dependencies in Maven - Andres Almiray
Executing mvn verify from the IDE's terminal displays the same warning as before, after all, that's regular Maven thus no change in behavior ......
Read more >
Learning the Basics - Gradle User Manual
Declaring multiple repositories is helpful if some dependencies are only available in one repository but not the other. You can mix any type...
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