webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

Document webpack change: support destructuring assignment with AwaitExpression

Open webpack-bot opened this issue 2 years ago • 0 comments

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 exportsFromEnumerable to the ImportParserPlugin class to format the requested exports from an import statement (link)
  • Refactor the use of Array.from with exportsFromEnumerable to 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 the destructuringAssignmentPropertiesFor method from the JavascriptParser class and adding a warning if the webpackExports option is used (link, link, link)
  • Add test case files test/cases/chunks/destructuring-assignment/dir1/a.js, test/cases/chunks/destructuring-assignment/index.js, and test/cases/chunks/destructuring-assignment/warnings.js to verify the functionality and warnings of the ImportParserPlugin and the destructuringAssignmentPropertiesFor method (link, link, link)

webpack-bot avatar Apr 15 '23 22:04 webpack-bot