rollup / plugins

🍣 The one-stop shop for official Rollup plugins
MIT License
3.62k stars 580 forks source link

fix(esm-shim): do not insert shims at `import` literal #1696

Closed younggglcy closed 5 months ago

younggglcy commented 6 months ago

Rollup Plugin Name: @rollup/plugin-esm-shim

This PR contains:

Are tests included?

Breaking Changes?

If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.

List any relevant issue numbers:

resolves #1649

Description

See the repro #1649 given, the shims were inserted into wrong position because the object

{
  keyword: ' import',
  dn: '',
};

matches the ESMStaticImportRegex regex.

This PR fixes it by disallowing \n in the specifier group in the regex.

tada5hi commented 6 months ago

looking good

younggglcy commented 6 months ago

ping politely here. can anyone help merge this pr