You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Try to require any package where the import statement uses a valid javascript variable name (any char, number class plus $, _) that doesn't match the regex \w. as an example, @progress/kendo-ui which requires jsQuery using the variable name jQuery$1
Possible Solution
The regex could be rewritten to '#(?:import\s*(?:[\w\$\d]+,)?(?:(?:\{[^}]*\}|[\w\$\d]+|\*\s*as\s+\w+)\s*\bfrom\s*)?|export\s*(?:\{[^}]*\}|\*)\s*from\s*)("/npm/((?:@[^/]+/)?[^@]+?)(?:@([^/]+))?((?:/[^/]+)*?)/\+esm")#' to capture $, but this is still fraught with danger as javascript variable names may include Unicode surprises.
Additional Context
Additionally, if the content is very large, there may be pcre.backtrack_limit errors. (trying to replace the [\w\$\d] references with [^\s] references would lead to NULL results in preg_replace_callback due to backtrack errors in the regex.)
This feature may need to be completely rewritten to avoid regular expressions.