Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add test case to pr-16701 #18343

Merged
merged 1 commit into from Apr 22, 2024

Conversation

hai-x
Copy link
Contributor

@hai-x hai-x commented Apr 21, 2024

What kind of change does this PR introduce?
Add test case to pr-16701

Did you add tests for your changes?
Yes

Does this PR introduce a breaking change?
No

What needs to be documented once your changes are merged?
No

@webpack-bot
Copy link
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)

@hai-x
Copy link
Contributor Author

hai-x commented Apr 21, 2024

xxx is not function error will occur when revert pr-16701

image

@hai-x
Copy link
Contributor Author

hai-x commented Apr 22, 2024

Reproduction steps:

  • multi-page application which has multiple entrances.
  • runtimeChunk: true make every entry has its own runtime
  • One module like above module(common) or module(pure) is included by Two chunks like above chunks chunk-reason-webpackChunkName.js and chunk-reason-split-chunks.js.
  • Every chunk in chunkGraph has its runtimes. so for chunk(chunk-reason-webpackChunkName.js) that chunk.runtimes = [[runtime~entry2, runtime~entry3], runtime~entry1]
  • The codeGenerationJobs of module(common) will be generated:
[{
	module: common, 
	hash, 
	runtime: [runtime~entry2, runtime~entry3], 
	runtimes: [[runtime~entry2, runtime~entry3]]
},{
	module: common, 
	hash, 
	runtime: 'runtime~entry1', 
	runtimes: [runtime~entry1]
}]
  • The codeGenerationJobs of module(pure) will be generated:
[{
	module: pure, 
	hash, 
	runtime: [runtime~entry2, runtime~entry3], 
	// Following causes ERROR happens because of the same `moduleHash`
	runtimes: [[runtime~entry2, runtime~entry3],[runtime~entry1]]
}]
  • Module(pure) in chunk(chunk-reason-webpackChunkName.js) is only used in runtime~entry2 and runtime~entry1.
  • The codeGeneration of Module(pure) only uses runtimes[0] -> [runtime~entry2, runtime~entry3] and generates code of PureDependencyTemplate -> r.j === runtimeId(Module(pure)) because it is only used in runtime~entry2, not used in runtime~entry3.

@alexander-akait alexander-akait merged commit 6d58e8d into webpack:main Apr 22, 2024
52 of 56 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants