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

Build issue when upgrading to version 1.2.x #546

Closed
rkreutzer opened this issue Jun 1, 2021 · 3 comments
Closed

Build issue when upgrading to version 1.2.x #546

rkreutzer opened this issue Jun 1, 2021 · 3 comments
Assignees
Labels
bug Something isn't working triage

Comments

@rkreutzer
Copy link
Contributor

Bug severity
4

Describe the bug
After upgrading from version 1.0.1 to version 1.2.0 (or @latest or @next), the build step for my app fails with:
Error: ./node_modules/did-jwt/lib/index.js 1:4514 -- Module parse failed: Unexpected token (1:4514) -- You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.

It appears to point to the statement with the first use of Optional Chaining in that program.

I've tried to upgrade and downgrade did-jwt, but still the same issue. I also tried adding resolutions to downgrade it in the package.json. Any ideas?

Versions:

  • Veramo: 1.2.x
  • OS: Windows 10
  • Node: 14.16.0
  • npm: 6.14.13
  • ionic: 6.16.1
  • angular: 8.3.29
  • yarn: 1.22.10
  • typescript: 4.3.2
@rkreutzer rkreutzer added the bug Something isn't working label Jun 1, 2021
@mirceanis
Copy link
Member

We've seen a similar error before and it was fixed by using node 14 to build (but you seem to already be using node14).

In your case I suspect it might be an issue with your babel config.
Perhaps this will help https://medium.com/@iamjasonchild/optional-chaining-in-javascript-via-babel7-e83c07127d62

Also, possibly related issues:
decentralized-identity/did-jwt#175
decentralized-identity/did-jwt#168

@jasheal
Copy link

jasheal commented Jun 3, 2021

@rkreutzer

I have the JwtMessageHandler working as expected in ionic (serving locally in chrome) by adding a polyfill to polyfill.ts

(window as any).global = window;
// @ts-ignore
window.Buffer = window.Buffer || require('buffer').Buffer;

Can you add this and let me know if your issue persists?

Also, please see working example here: https://github.com/veramolabs/veramo-ionic

@rkreutzer
Copy link
Contributor Author

It appears that the way I upgraded was the issue. I had done a "yarn upgrade" command listing all the @veramo modules and that apparently caused the issue. I deleted the node_modules folder, updated the version numbers in the package.json file, then did a "yarn install". That cleared the issue.

Jason, I already had similar statements in the polyfills file, but thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

3 participants