GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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 #17014

New issue
Copy link
New issue
Copy link
Closed
#19652
Closed
Generated code not run when outputModule: true and entry chunk dependent on common chunk#17014
#19652
Copy link
Labels
status: staleNo author response after a needs: request; close candidatewebpack-5Concerns the webpack 5 line

Description

@ahabhgk
ahabhgk
opened on Apr 18, 2023
Issue body actions

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:

export default true

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

Activity

Next
  1. ahabhgk
    changed 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, 2023
  2. alexander-akait commented on Apr 18, 2023

    @alexander-akait
    alexander-akait
    on Apr 18, 2023
    Member
    More actions

    Yeah, I see

  3. alexander-akait
    added
    bug
    webpack-5Concerns the webpack 5 line
    on Apr 18, 2023
  4. alexander-akait
    added this to webpack 5/6on Apr 18, 2023
  5. alexander-akait
    moved this to Backlog in webpack 5/6on Apr 18, 2023
  6. alexander-akait commented on Apr 18, 2023

    @alexander-akait
    alexander-akait
    on Apr 18, 2023
    Member
    More actions

    @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(...)

  7. alexander-akait commented on Apr 18, 2023

    @alexander-akait
    alexander-akait
    on Apr 18, 2023
    Member
    More actions

    Also if you speficity options manually (chunkFormat and etc) all works fine too, so something wrong with our defaults...

  8. alexander-akait commented on Apr 18, 2023

    @alexander-akait
    alexander-akait
    on Apr 18, 2023
    Member
    More actions

    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

  9. ahabhgk commented on Apr 18, 2023

    @ahabhgk
    ahabhgk
    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.

  10. TheLarkInn
    moved this from Backlog to Priority - High in webpack 5/6on Apr 18, 2023
  11. webpack-bot commented on Jul 19, 2023

    @webpack-bot
    webpack-bot
    on Jul 19, 2023
    Contributor
    More actions

    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.

  12. webpack-bot
    added
    status: staleNo author response after a needs: request; close candidate
    on Jul 19, 2023
  13. steverep commented on Jul 21, 2023

    @steverep
    steverep
    on Jul 21, 2023
    Contributor
    More actions

    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.

  14. webpack-bot
    removed
    status: staleNo author response after a needs: request; close candidate
    on Jul 21, 2023
  15. 12 remaining items

  16. webpack-bot
    added
    status: staleNo author response after a needs: request; close candidate
    on Aug 10, 2024
  17. webpack-bot
    closed this as completedon Aug 25, 2024
  18. alexander-akait
    reopened this on Sep 3, 2024
  19. webpack-bot
    removed
    status: staleNo author response after a needs: request; close candidate
    on Sep 3, 2024
  20. alexander-akait commented on Nov 20, 2024

    @alexander-akait
    alexander-akait
    on Nov 20, 2024
    Member
    More actions

    @ahabhgk I think the same - #13852, did you find a fix in rspack?

  21. ahabhgk commented on Nov 21, 2024

    @ahabhgk
    ahabhgk
    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

  22. alexander-akait commented on Nov 21, 2024

    @alexander-akait
    alexander-akait
    on Nov 21, 2024
    Member
    More actions

    @ahabhgk Thanks for the feedback, I'll try to find a solution (what's the problem) after the next issue

  23. webpack-bot
    added
    status: staleNo author response after a needs: request; close candidate
    on Feb 20, 2025
  24. webpack-bot
    closed this as completedon Mar 7, 2025
  25. alexander-akait
    reopened this on Mar 10, 2025
  26. AztecBot
    added a commit that references this issue on Apr 23, 2025

    refactor: bb.js non-inlined web workers (#13736)

    96ea0b2
  27. Thunkar
    added a commit that references this issue on Apr 28, 2025

    refactor: bb.js non-inlined web workers (#13736)

    893e9d2
  28. alexander-akait
    closed this as completedin #19652on Jul 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: staleNo author response after a needs: request; close candidatewebpack-5Concerns the webpack 5 line

    Type

    No type

    Fields

    Priority

    None yet

    Projects

      • webpack 5/6
        Closed
        Status
        Priority - High
        Show more project fields

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.