GeezerVison is showing github.com — Generated code not run when `outputModule: true` and entry chunk dependent on common chunk · Issue #17014 · webpack/webpack
Generated code not run when outputModule: true and entry chunk dependent on common chunk #17014Description
Bug report
If the current behavior is a bug, please provide the steps to reproduce.
repro #1: https://github.com/ahabhgk/webpack-output-module-repro
repro #2: #17870
repro #3: #13852
What is the current behavior?
index.js:
import common from './common.js`
console.log(common)
common.js:
webpack config:
module.exports = {
experiments: {
outputModule: true,
},
target: 'es2020',
optimization: {
splitChunks: {
cacheGroups: {
common: {
test: /common\.js/,
minSize: 0,
chunks: 'all'
}
}
}
}
}
run the build output: node ./dist/main.mjs, it will log nothing, but it should log true
Other relevant information:
webpack version: ^5.79.0
Node.js version: 16
Operating System: OSX Reacted by Tirth Bodawala, Steve Repsher and 9aoy Activitychanged the title [-]Generated code not run when `outputModule: true` and entry chunk dependent common chunk[/-] [+]Generated code not run when `outputModule: true` and entry chunk dependent on common chunk[/+] on Apr 18, 2023alexander-akait commented on Apr 18, 2023 alexander-akait commented on Apr 18, 2023 @ahabhgk Oh, there is no problems with webpack runtime, something wrong with target, if you change it to target: "web" (or node) all works fine, but if you change it to ['es2020', 'web'], it doesn't work Yeah, we don't generate right output for es2020 with import(...) alexander-akait commented on Apr 18, 2023 Also if you speficity options manually (chunkFormat and etc) all works fine too, so something wrong with our defaults... alexander-akait commented on Apr 18, 2023 Note: target: 'es2020', is not valid good value, because we don't know your env, so you should use target: ['es2020', 'web'] or ['es2020', 'node'], anyway if you use just es2020 you will need to setup chunkFormat (and etc) manually ahabhgk commented on Apr 18, 2023 ContributorAuthor More actions I'm trying to find a chunkFormat that can run both on browser and node, target: "universal" would be perfect, but not implement yet, so I tried chunkFormat: "module" and found this bug. webpack-bot commented on Jul 19, 2023
This issue had no activity for at least three months.
It's subject to automatic issue closing if there is no activity in the next 15 days. steverep commented on Jul 21, 2023 Certainly should keep this open. It also causes ESM web workers not to load if they are split using default optimization as discussed in #17298. alexander-akait commented on Nov 20, 2024 ahabhgk commented on Nov 21, 2024 ContributorAuthor More actions No, I haven't found a suitable fix that can be built into Rspack/or webpack, we usually just let user to use chunks: "async" and disable runtime chunk to avoid split the entry chunk alexander-akait commented on Nov 21, 2024 @ahabhgk Thanks for the feedback, I'll try to find a solution (what's the problem) after the next issue
MetadataMetadataStatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|