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

Uncaught SyntaxError: Unexpected token '.' #8

Open
1wheel opened this issue Jun 11, 2020 · 4 comments · Fixed by #14
Open

Uncaught SyntaxError: Unexpected token '.' #8

1wheel opened this issue Jun 11, 2020 · 4 comments · Fixed by #14

Comments

@1wheel
Copy link
Owner

1wheel commented Jun 11, 2020

Something to do with whitespace at the start of the file, probably the line number offset hack throwing something off.

@curran
Copy link
Contributor

curran commented Aug 26, 2022

The line number hack causes issues for me as well.

Example:

My code:

const {
  select,
  scaleLinear,
  scalePoint,
  extent,
  line,
  cross,
  csv,
} = d3;

The code that runs:

(function anonymous(
) {
;const {;  select,
  scaleLinear,
  scalePoint,
  extent,
  line,
  cross,
  csv,
} = d3;

image

@curran
Copy link
Contributor

curran commented Aug 26, 2022

Maybe that line number hack could be removed?

curran added a commit to curran/hot-server that referenced this issue Aug 26, 2022
@1wheel
Copy link
Owner Author

1wheel commented Nov 10, 2022

Having correct line numbers would be nice, maybe something like:

str.replace('\n', ';').replace('\n', ';').replace('{;', '{')

or a more sophisticated regex?

@1wheel
Copy link
Owner Author

1wheel commented Nov 10, 2022

Dynamically adding a script tag to the page would also fix.

@1wheel 1wheel reopened this Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants