rspack icon indicating copy to clipboard operation
rspack copied to clipboard

[Bug]: Incorrect parsing of `webpackInclude`

Open elsassph opened this issue 1 year ago • 2 comments

System Info

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.06 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    pnpm: 9.4.0 - ~/.nvm/versions/node/v18.17.1/bin/pnpm
    bun: 1.0.15 - ~/.bun/bin/bun
  Browsers:
    Chrome: 126.0.6478.183
    Safari: 17.5
  npmPackages:
    @rspack/cli: 1.0.0-beta.0 => 1.0.0-beta.0 
    @rspack/core: 1.0.0-beta.0 => 1.0.0-beta.0 

Details

rspack

PR #7055 added support for some Webpack "magic comments", but but webpackInclude is incorrect:

/* webpackInclude: /^.{2,}$/ */

Results in an error which seem to suggest the regex has been incorrectly extracted:

Magic comments parse failed: `webpackInclude` expected a regular expression, but received: /^.{2.

Looking at the PR it seems the extraction logic stops at ,: https://github.com/web-infra-dev/rspack/pull/7055/files#diff-d53d879b548a6442e88215394f482df179f48e7f98e20f401f84051fef5bd63cR132

Reproduce link

N/A

Reproduce Steps

N/A

elsassph avatar Jul 29 '24 14:07 elsassph