Preserve star exports for externalized dependencies in module output
See original GitHub issueBug report
What is the current behavior? When code contains exports from externalized libraries, the export statements are not preserved in output when they should be.
If the current behavior is a bug, please provide the steps to reproduce. Simple isolated repro (with details in the README): https://github.com/dzearing/test-webpack-esm
We bundle a simple entry point which contains:
export * from '@fluentui/utilities';
We turn on output.library.type="module"
in the webpack config and mark the library as external. The bundle preserved should still emit the export. Instead it contains a bunch of unexpected content:
import*as e from"@fluentui/utilities";var r={d:(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r)};r.d({},{});
What is the expected behavior? The output should match the input and export * from the library.
webpack version: 5.67.0 Node.js version: 16.13.1 Operating System: Windows 11
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Package exports - webpack
The exports field in the package.json of a package allows to declare which module should be used when using module requests like import...
Read more >Requiring modules in Node.js: Everything you need to know
Node uses two core modules for managing module dependencies: The require module, which appears to be available on the global scope — no...
Read more >Node Modules at War: Why CommonJS and ES ... - Code Red
CJS scripts use require() and module.exports ; ESM scripts use import and export . ESM and CJS are completely different animals.
Read more >What is the difference between "Module Dependencies" and ...
jar and dependent libraries into output root. This way library archives will be copied along with created .jar. You also need to create...
Read more >CLI options - Terragrunt
terragrunt plan terragrunt apply terragrunt output terragrunt destroy # etc ... If you have a stack of Terragrunt modules with dependencies between ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @alexander-akait for the input and help. I’ve adjusted the title to fit more; either we can use this to track the specific ask, or close if it’s already tracked in the module support issue.
I understand what you want to achieve, but currently only one workaround - named export