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

core.js: Uncaught (in promise) SyntaxError: Invalid or unexpected token #4823

Closed
rafaellichen opened this issue Jul 27, 2021 · 5 comments
Closed

Comments

@rafaellichen
Copy link

rafaellichen commented Jul 27, 2021

Please help; thanks in advance :)

Environment

  • Package version(s): @blueprintjs/core@3.47.0
  • Operating System: macOS Big Sur Version 11.4
  • Browser name and version: Google Chrome, Version 92.0.4515.107 (Official Build) (x86_64)

Code Sandbox

Link to a minimal repro: https://mybinder.org/v2/gh/idom-team/idom-jupyter/main?filepath=notebooks%2Fintroduction.ipynb

Steps to reproduce

Visit the link above, wait for jupyter notebook env. to build. After that, paste the following on a new cell and run.
If not seeing the error, do a browser cache clear to force the javascript file refetch.

import idom
import idom_jupyter

victory = idom.web.module_from_template("react", "ipyreact@1.0.12", fallback="...")
VictoryBar = idom.web.export(victory, "Annotator")

@idom.component
def VictoryBarElement():
    return VictoryBar()

VictoryBarElement()

Actual behavior

In the browser console, error: Uncaught (in promise) SyntaxError: Invalid or unexpected token
The error originates from the linked file core.js on: https://cdn.esm.sh/v43/@blueprintjs/core@3.47.0/es2020/core.js
Use text search to find the only code starting with 1.tolocal or t=1; this is where the error starts.

Expected behavior

Probably should not have error here?

Possible solution

N/A

@adidahiya
Copy link
Contributor

This looks like a problem with binder or jupyter notebook, not with Blueprint.

@rafaellichen
Copy link
Author

rafaellichen commented Jul 28, 2021

@adidahiya I am really confused, am I miss something?
This is the error I get if I paste the https://cdn.esm.sh/v43/@blueprintjs/core@3.47.0/es2020/core.js inside vscode:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Identifier_after_number.
When I run 1.toLocaleString('ar-EG'); in browser console, it still gives the same error: Uncaught SyntaxError: Invalid or unexpected token (which is expected because I got the same error when importing it in the test environment above).

@adidahiya
Copy link
Contributor

I'm not familiar with esm.sh; that file you linked is not something published in the @blueprintjs/core package. Can you explain a bit more how that core.js file was generated?

@rafaellichen
Copy link
Author

@adidahiya
I am not familiar with esm.sh either, but I think it's very similar to https://unpkg.com/. Both are CDN services to delivery the es modules faster. So based on the explanation in "workflow", the process is somewhat automatic. When I published my package for testing using microbundle-crl --no-compress --format modern,cjs to build, it becomes available on esm.sh too. Let me know if this is helpful.
Misc. links:
reactive-python/reactpy#455
reactive-python/reactpy#452

@rafaellichen
Copy link
Author

rafaellichen commented Jul 30, 2021

@adidahiya resolved by changing package build method. Thanks for the helps.

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

2 participants