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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document webpack change: feat: added fetchPriority #6907

Closed
webpack-bot opened this issue Jun 14, 2023 · 0 comments 路 Fixed by #6915
Closed

Document webpack change: feat: added fetchPriority #6907

webpack-bot opened this issue Jun 14, 2023 · 0 comments 路 Fixed by #6915

Comments

@webpack-bot
Copy link

A pull request by @alexander-akait was merged and maintainers requested a documentation change.

See pull request: webpack/webpack#17249


due to outdated fork I recreate a new

fixes #16991
fixes #16989

Summary

馃 Generated by Copilot at 4b6eed7

This pull request adds a new feature to webpack that allows setting the fetch priority of dynamic imports, either globally or individually. This feature can improve the loading performance of async chunks by using the fetchPriority attribute on script tags. The pull request modifies several files in the lib, schemas and test folders to implement, validate and test this feature. It also updates the cspell.json file to add a new word related to this feature.

Details

馃 Generated by Copilot at 4b6eed7

  • Add a new feature to allow setting the fetch priority for dynamic imports using the fetchPriority attribute on script tags (link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link, link)
  • Add a new parser option dynamicImportFetchPriority to specify the global fetch priority for dynamic imports in lib/config/defaults.js (link)
  • Add a new property fetchPriority to the ChunkGroup class to store the fetch priority option for a chunk group in lib/ChunkGroup.js (link)
  • Add a new case for the fetchPriority property in the ImportMetaContextDependencyParserPlugin class to parse the import.meta object for dynamic imports in lib/dependencies/ImportMetaContextDependencyParserPlugin.js (link)
  • Add a new condition to the ImportParserPlugin class to check the dynamicImportFetchPriority option and set the groupOptions.fetchPriority accordingly in lib/dependencies/ImportParserPlugin.js (link)
  • Add a new condition to the ImportParserPlugin class to check the webpackFetchPriority property in the importOptions object and set the groupOptions.fetchPriority accordingly or add a warning in lib/dependencies/ImportParserPlugin.js (link)
  • Add a new class ChunkFetchPriorityFunctionRuntimeModule to generate the runtime code for the getFetchPriority function that returns the fetch priority for a given chunk id in lib/prefetch/ChunkFetchPriorityFunctionRuntimeModule.js (link)
  • Add a new hook to the ChunkPrefetchPreloadPlugin class to iterate over the async chunks and collect the fetch priorities and add a new ChunkFetchPriorityFunctionRuntimeModule and the getFetchPriority requirement if needed in lib/prefetch/ChunkPrefetchPreloadPlugin.js (link)
  • Add a new parameter hasGetFetchPriority to the LoadScriptRuntimeModule class to determine if the loadScript function should use the fetchPriority attribute or not in lib/runtime/LoadScriptRuntimeModule.js (link)
  • Add a new condition to the LoadScriptRuntimeModule class to generate the code to set the fetchPriority attribute on the script tag using the getFetchPriority function and the chunk id in lib/runtime/LoadScriptRuntimeModule.js (link)
  • Add a new argument fetchPriority to the loadScript function signature and pass it to the createScript function call in lib/runtime/LoadScriptRuntimeModule.js (link)
  • Add a new runtime global function getFetchPriority to return the fetch priority for a given chunk id in lib/RuntimeGlobals.js (link)
  • Add a new condition to the RuntimePlugin class to check the getFetchPriority requirement and pass it as an argument to the LoadScriptRuntimeModule constructor in lib/RuntimePlugin.js (link)
  • Add a new condition to the JsonpChunkLoadingRuntimeModule class to check the getFetchPriority requirement and store it in a local variable withFetchPriority in lib/web/JsonpChunkLoadingRuntimeModule.js (link)
  • Add a new condition to the JsonpChunkLoadingRuntimeModule class to generate the code to declare and assign the fetchPriority variable using the getFetchPriority function and the chunk id in lib/web/JsonpChunkLoadingRuntimeModule.js (link)
  • Add a new argument fetchPriority to the loadScript function call and pass it if the withFetchPriority variable is true in lib/web/JsonpChunkLoadingRuntimeModule.js (link)
  • Add a new schema definition for the dynamicImportFetchPriority option to validate the webpack configuration in schemas/WebpackOptions.json (link)
  • Add a new test case to test the inline webpackFetchPriority option for dynamic imports in test/cases/chunks/inline-options/index.js (link)
    • Add new files a.js, b.js and c.js to test the inline webpackFetchPriority option for dynamic imports in test/cases/chunks/inline-options/dir14/ (link, link, link)
  • Swap the order of the words "IIFE" and "IIFE's" and "webpack" and "webpack's" in the cspell.json file to keep the words in alphabetical order (link, link)
  • Remove the second argument of false from the call to the getChildIdsByOrdersMap method of the chunk object in the ChunkPrefetchPreloadPlugin class, which is not needed since the fetch priority is optional (link)
  • Destructure the dynamicImportFetchPriority option from the options object and store it in a local variable in the ImportParserPlugin class, which is a minor refactoring (link)
  • Add a new file a.js to test the global dynamicImportFetchPriority option for dynamic imports in test/configCases/web/fetch-priority-2/ (link)
    • Add new files b.js and c.js to test the global dynamicImportFetchPriority option for dynamic imports in test/configCases/web/fetch-priority-2/ (link, link)
  • Add a new default value for the dynamicImportFetchPriority option to test the default values of the webpack configuration in test/Defaults.unittest.js (link)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant