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
When using babel-loader, some comments in JavaScript are converted incorrectly. E.g.,
// Single line comment /* with block comment inside */
is translated to
/* Single line comment /* with block comment inside */ */
This is invalid JS as the first comment end terminates the whole thing, and the second */ is treated as code (producing an error).
The actual error when building using webpack (coming from Pako in this instance, but isn't limited to this package):
ERROR in ./node_modules/@progress/pako-esm/dist/pako-esm2015.js 3476:106
Module parse failed: Unexpected token (3476:106)
File was processed with these loaders:
* ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| * not null.
| */
> function gen_bitlen(s, desc) /* deflate_state *s;*/ /* tree_desc *desc; /* the tree descriptor */*/{
| var tree = desc.dyn_tree;
| var max_code = desc.max_code;
Expected/desired behavior:
It should not convert these comments.
Suggested fix:
This problem has been corrected in @babel/generator version 7.20.3 (released on the day I am posting this). Upgrading babel-loader to use this new version of the package will fix the issue.
Suggested workaround for people experiencing this issue in the meantime:
Adding an override section in your package.json with @babel/generator force updated fixes the issue for now.
"overrides": {
"@babel/generator": "7.20.3"
}
The text was updated successfully, but these errors were encountered:
The overrides section is supported in npm 8.3+, and more importantly, it is meant to be used by end users, not package authors.
Currently @babel/generator is not a direct dependency of babel-loader, instead it requires a peerDependency @babel/core: ^7.12.0, which depends on @babel/generator: ^7.12.0, which covers @babel/generator: 7.20.3 per semver specification.
Webpack Version:
5.72.1
Babel Core Version:
7.19.3
Babel Loader Version:
9.1.0
Please tell us about your environment:
Windows 10
Current behavior:
When using babel-loader, some comments in JavaScript are converted incorrectly. E.g.,
// Single line comment /* with block comment inside */
is translated to
/* Single line comment /* with block comment inside */ */
This is invalid JS as the first comment end terminates the whole thing, and the second */ is treated as code (producing an error).
The actual error when building using webpack (coming from Pako in this instance, but isn't limited to this package):
Expected/desired behavior:
It should not convert these comments.
Suggested fix:
This problem has been corrected in @babel/generator version 7.20.3 (released on the day I am posting this). Upgrading babel-loader to use this new version of the package will fix the issue.
Suggested workaround for people experiencing this issue in the meantime:
Adding an override section in your package.json with @babel/generator force updated fixes the issue for now.
The text was updated successfully, but these errors were encountered: