webpack.js.org
webpack.js.org copied to clipboard
Document webpack change: support destructuring assignment with AwaitExpression
A pull request by @vankop was merged and maintainers requested a documentation change.
See pull request: https://github.com/webpack/webpack/pull/16995
related to https://github.com/webpack/webpack/issues/14800
Summary
🤖 Generated by Copilot at 3824bee
This pull request adds support for import statements with destructuring assignment in the ImportParserPlugin and fixes a bug in the JavascriptParser that affected dynamic imports with await. It also adds new test cases and warnings to cover the new functionality and the incompatible option.
Details
🤖 Generated by Copilot at 3824bee
- Add a helper function
exportsFromEnumerableto theImportParserPluginclass to format the requested exports from an import statement (link) - Refactor the use of
Array.fromwithexportsFromEnumerableto avoid code duplication and improve readability (link) - Handle the case of import statements using destructuring assignment, such as
const { default: def } = await import("./dir1/a");, by using thedestructuringAssignmentPropertiesFormethod from theJavascriptParserclass and adding a warning if thewebpackExportsoption is used (link, link, link) - Add test case files
test/cases/chunks/destructuring-assignment/dir1/a.js,test/cases/chunks/destructuring-assignment/index.js, andtest/cases/chunks/destructuring-assignment/warnings.jsto verify the functionality and warnings of theImportParserPluginand thedestructuringAssignmentPropertiesFormethod (link, link, link)