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

Document webpack change: Chunk loading method per entrypoint #3940

Closed
webpack-bot opened this issue Aug 28, 2020 · 2 comments · Fixed by #3986
Closed

Document webpack change: Chunk loading method per entrypoint #3940

webpack-bot opened this issue Aug 28, 2020 · 2 comments · Fixed by #3986
Projects

Comments

@webpack-bot
Copy link

A pull request by @sokra was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#11385


This is preparation work to add support for

  • __webpack_entry__ to create a entrypoint from inside of source code. Returns the paths to the files needed for this entrypoint.
  • new Worker(new URL("./worker", import.meta.url), { type: "module" }) to create a webworker. It will be added as entrypoint with different chunk loading method.

What kind of change does this PR introduce?
refactoring, feature

Did you add tests for your changes?
yes + existing tests

Does this PR introduce a breaking change?
yes

What needs to be documented once your changes are merged?

  • renames:
    • output.hotUpdateFunction -> output.hotUpdateGlobal
    • output.jsonpFunction -> output.chunkLoadingGlobal
    • output.chunkCallbackFunction -> output.chunkLoadingGlobal
  • new options:
    • output.chunkLoading: The method of loading chunks (methods included by default are 'jsonp' (web), 'import-scripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
    • output.chunkFormat: The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
    • defaults are chosen based on target option
    • output.enabledChunkLoadingTypes: List of chunk loading types enabled. Will be automatically filled by webpack. Only needed when using a function as entry option and returning chunkLoading option from there.
    • entry.*.chunkLoading: Like output.chunkLoading but only for this entry.
  • output.library and output.chunkLoading now also allow any string in schema, to support adding custom types via plugins.
  • output.globalObject defaults to self instead of window of web-like targets
@anshumanv
Copy link
Member

wip

anshumanv added a commit to anshumanv/webpack.js.org that referenced this issue Sep 18, 2020
@sokra sokra added this to Not important in webpack 5 Oct 7, 2020
@sokra sokra moved this from Not important to Advanced configuration/code in webpack 5 Oct 7, 2020
webpack 5 automation moved this from Advanced configuration/code (not important) to Done Oct 7, 2020
sokra added a commit that referenced this issue Oct 7, 2020
* fixes #3940: document changes to several config options

* Apply suggestions from code review

Co-authored-by: Fernando Montoya <montogeek@gmail.com>

* fixup fragments

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Fernando Montoya <montogeek@gmail.com>
@bertho-zero
Copy link

bertho-zero commented Apr 30, 2021

Can we set chunkLoadingGlobal per entrypoint?

I am using the plugin https://github.com/gregberge/loadable-components which modifies chunkLoadingGlobal but the problem is that it "captures" all my entrypoints.

Related issue: gregberge/loadable-components#751

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants