LearnNewsExamplesServices
Frontmatter
id5489
titleWebpack creates wrong bundles (harmony) which can load & instanciate singletons multiple times
stateClosed
labels
bughelp wantedstale
assignees[]
createdAtJun 26, 2024, 3:45 PM
updatedAtOct 10, 2024, 4:33 AM
githubUrlhttps://github.com/neomjs/neo/issues/5489
authortobiu
commentsCount4
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtOct 10, 2024, 4:33 AM

Webpack creates wrong bundles (harmony) which can load & instanciate singletons multiple times

Closed v8.1.0 bughelp wantedstale
tobiu
tobiu commented on Jun 26, 2024, 3:45 PM

i did not see it before using our LivePreview which dynamically imports apps which can dynamically import other modules.

sadly this is a "game over" for our dist/development & dist/production env.

imho we do not need harmony these days anyway => browsers and node are capable of using real JS modules.

Screenshot 2024-06-26 at 15 09 57

Screenshot 2024-06-26 at 15 14 47
Screenshot 2024-06-26 at 15 15 15
Screenshot 2024-06-26 at 15 15 40

@sokra

tobiu added the bug label on Jun 26, 2024, 3:45 PM
tobiu added the help wanted label on Jun 26, 2024, 6:00 PM
tobiu
tobiu Jun 26, 2024, 6:01 PM

steps to reproduce:

  • clone the repo
  • npm i
  • npm run build threads => app => development (or alternatively npm run build-all)
tobiu
tobiu Jun 27, 2024, 11:02 AM

i stepped more through the build logic and the new trouble-maker obviously is the LivePreview component.

Screenshot 2024-06-27 at 10 51 06

it makes sense: we have a string, which can change in any possible way at run-time, which then gets parsed (replacing static with dynamic imports) and then converted into JS.

IF the previews were readOnly, we could probably monkey-patch it (magic comments to ignore our custom logic and telling build-tools exactly what to import instead)

otherwise, the LivePreview is limited to the dev mode.

This still does not justify though that Webpack sneaks in singletons more than once.

@github-actions - 2024-09-26T02:32:41Z

This issue is stale because it has been open for 90 days with no activity.

  • 2024-09-26T02:32:42Z @github-actions added the stale label

@github-actions - 2024-10-10T02:33:37Z

This issue was closed because it has been inactive for 14 days since being marked as stale.

  • 2024-10-10T02:33:37Z @github-actions closed this issue