Open elsassph opened 1 month ago
Looking at the PR it seems the extraction logic stops at
,
Yes, this is an known issue. Webpack uses vm
to eval the magic comments. But Rspack parses magic comments in rust, so we can only try to extract them with regular expressions. And also the rust std::regexp
does not support (?!)
so the extraction logic stops at ,
to get the regular expression of webpackInclude
and webpackExclude
.
You can just avoid to use ,
. We are trying to find a better way to parse the magic comments.
Good that you're aware, we'll work around the limitation.
FWIW it seems to me that Webpack parses those comments like JSON
/* webpackInclude: /^.{2,}$/ */
would be parsed as { webpackInclude: /^.{2,}$/ }
.
System Info
Details
rspack
PR #7055 added support for some Webpack "magic comments", but but
webpackInclude
is incorrect:Results in an error which seem to suggest the regex has been incorrectly extracted:
Looking at the PR it seems the extraction logic stops at
,
: https://github.com/web-infra-dev/rspack/pull/7055/files#diff-d53d879b548a6442e88215394f482df179f48e7f98e20f401f84051fef5bd63cR132Reproduce link
N/A
Reproduce Steps
N/A