Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Module parse failed: Unexpected token @progress/pako-esm/dist/pako-esm2015.js #3844

Closed
rajeshbayya opened this issue Nov 7, 2022 · 5 comments

Comments

@rajeshbayya
Copy link

Getting Below error when we build with angular 12. Please help.

Packages used
| +-- @progress/kendo-angular-excel-export@4.0.4
| | +-- @progress/kendo-file-saver@1.1.1
| | +-- @progress/kendo-ooxml@1.7.0
| | | +-- @progress/jszip-esm@1.0.3
| | | | `-- @progress/pako-esm@1.0.1 deduped

and
| +-- @progress/kendo-drawing@1.17.1
| | `-- @progress/pako-esm@1.0.1
Build Error
. @/node_modules/@progress/pako-esm/dist/pako-esm2015.js:3476:106 - Error: Module parse failed: Unexpected token (3476:106)
File was processed with these loaders:

  • ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
  • ./node_modules/@ngtools/webpack/src/ivy/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;

@jmaronge
Copy link

jmaronge commented Nov 7, 2022

I am getting this as well. Our builds have been broken with this since 11/04/2022.

Absolutely no changes to our code or package.json were made between these 2 builds, the error just started to appear and we can not find a way to get the builds to pass.

Here are the timestamps from our logs. It appears this broke after 2022-11-04 12:16:45 CST.

[2022-11-04 17:20:36] (Failed)
[2022-11-04 12:16:45] (Pass)

We are using Angular 13.3.6

./node_modules/@progress/pako-esm/dist/pako-esm2015.js:3476:106 - Error: Module parse failed: Unexpected token (3476:106)
File was processed with these loaders:

  • ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js
  • ./node_modules/source-map-loader/dist/cjs.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;

@dtopalov
Copy link
Contributor

dtopalov commented Nov 8, 2022

Hello,

The described error seems to be caused by an issue with Babel:

babel/babel#15132

There is a fix in the latest Babel version:

https://stackoverflow.com/a/74348932/7009923

Can you please try updating Babel, or reverting it to an older version, or any of the other solutions, shared in this StackOverflow thread, and let us know whether this resolves the problem?

https://stackoverflow.com/questions/74323826/module-parse-failed-unexpected-token-257106-you-may-need-an-appropriate-load

@PieterVanPoyer
Copy link

Hello

We experienced the same issue. Babel seems to have a hard time speaking Javascript.

For now we reverted back from Angular 12.2 to Angular 12.1 .

This solution is not perfect off course.

And we keep watching the issue, maybe Angular will release a full working 12.2.x version soon.

Kind regards
Pieter

@jmaronge
Copy link

jmaronge commented Nov 9, 2022

We had to upgrade to Angular 14.2.9 to get this error to go away. While we were able to do this on some of our branches not all where using Angular 13 to start with and it would be too risky to upgrade to 14 on those. Does anyone have a real fix for this issue? I tried every combination of the solutions on both stackoverflow and babel's github site and nothing worked.

@tsvetomir
Copy link
Member

tsvetomir commented Nov 10, 2022

The Angular version shouldn't matter much, the issue is with the @babel/generator package. The latest version is good, but your project may be stuck on an older one. You have two options:

  1. Remove node_modules, package-lock.json and re-install. This should get you the latest versions of transitive dependencies, but may not be limited to Babel.

  2. Add an overrides section in your package.json (requires npm v8.3.0+):

    "overrides": {
      "@babel/generator": "7.20.4"
    }

We're also investigating the possibility to apply a fix in @progress/pako-esm, but this seems unnecessary for the moment. It would also require updating your node modules.

Edit: Correct package name in overrides.

@tsvetomir tsvetomir closed this as not planned Won't fix, can't repro, duplicate, stale Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants