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.

Same package appearing in multiple places gets included multiple times

See original GitHub issue

Do you want to request a feature or report a bug?

A bug

What is the current behavior?

See the repo to reproduce the issue: https://github.com/yachaka/webpack-duplicate-module-issue Having the following folder structure,

webpack.config.js // entry: package1/index.js
package1/
    package.json // dependency: lodash@4.17.4
    index.js // import package2 from '../package2'
package2/
    package.json // dependency: lodash@4.17.4
    index.js

With the files package1/index.js and package2/index.js being: package1/index.js

const _ = require('lodash');
require('../package2/');

package2/index.js

const _ = require('lodash');

Lodash gets included 2 times, even though it is the same version that is installed in both package. I though this was intended to be deduped.

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

lodash gets included only one time as the version in both package.json is the same

If this is a feature request, what is motivation or use case for changing the behavior? /

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System. Mac Sierra 10.12.5 node.js 8.1.4 webpack 3.4.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
evancaldwellcommented, Feb 28, 2018

I’m also trying to solve this. I was under the impression that Webpack did de-dupe these. The only way I have gotten it to work is having a peer dependency in the package2 package.json, ensuring that those peer dependencies are installed in package1’s node_modules and aliasing them in the webpack.config.js so the imports in both packages resolve properly when bundled. However, this also means that package1 has fake dependencies because if there is a shared dependency for package2 and a package3, package1 would also have to have that installed even if it doesn’t actually use it. It feels like if we are already in a build step this should be de-duped

2reactions
CharanRootcommented, Sep 26, 2019

yarn workspace config fixed

can you post yarn config.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple versions of the same package in the yarn.lock file
To investigate how many times a depenedency is installed and what packages dependens on it (recursivly), run: yarn why <package-name> .
Read more >
How do I use same figure multiple times? - TeX
Technically, the included image is placed only once in the resulting PDF and each additional instance just is a reference to the already ......
Read more >
Video: View files in split and multiple windows
Open the 2 documents. ... Want more? View two or more worksheets at the same time · Split panes to lock rows or...
Read more >
Chapter 7. Packages and Modules - Oracle Help Center
A package may not contain two members of the same name, or a compile-time error results. Here are some examples: Because the package...
Read more >
Effective Go - The Go Programming Language
Moreover, many of the packages contain working, self-contained executable ... and less time is devoted to the topic if everyone adheres to the...
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