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.

Can't create webpack module with dependOn for import

See original GitHub issue

Hello. I would like to create three entry points with, on of them is shared.

I’m trying to use dependOn entry option. When i will have been added dependOn into entry, entry format changed.

Run code like this in my frontend application:

import * as X from 'module'; console.log(X);

And see for module with dependOn: : image

Also for module without dependOn: : image

I don’t understand, how to right use dependOn for share some code between entris, because when i use it, i will see the import problem described above. Anyone could help, and explain how do it right? I can contribute into examples.

My reproducible example - https://github.com/lavcraft/react-hooks-composition-in-webpack-entry-problem-example

PS: I’m tried differente entry.library.type - all produce different kind of errors. Screenshots above made with entry.library.type: ‘this’ for debug purposes.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gaearoncommented, Apr 3, 2022

Usually what you should do is extract the shared part into a separate bundle, and then use externals to prevent it from being copied into other bundles.

2reactions
alexander-akaitcommented, Apr 3, 2022

@lavcraft Why you need dependOn for libraries, I don’t see any reasons for that

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Managing Webpack Dependencies - Toptal
The Webpack module bundler processes JavaScript code and all static assets, ... In the Modal.js file, we can now import datepicker much simpler:...
Read more >
Webpack. Created library with dependencies is not working
i.e. Data is not initialized. If I remove dependency Base from Data, then Data initialized: + Data |--- Data.js // import { ...
Read more >
Module Methods - webpack
Make all exports from the dependency available in the current scope. The require label can occur before a string. The dependency must export...
Read more >
How to Build a Micro Frontend with Webpack's Module ... - Bitovi
Resolves Dependency Issues. Federated code defines their dependencies and if Webpack can't find it in the scope, will download it. Module ...
Read more >
module-not-found - Next.js
The module you're trying to import is not installed in your dependencies ... When importing a module from npm this module has to...
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