Skip to content

Fix regex to match on .js but not on .json #5

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

Closed
wants to merge 1 commit into from

Conversation

abentkamp
Copy link

I ran into the following error when adding an npm package that attempted to import a json file:

✘ [ERROR] Expected ";" but found ":"

    node_modules/@leanprover/unicode-input/dist/abbreviations.json:2:8:
      2 │     "{}": "{$CURSOR}",
        │         ^
        ╵         ;

What's happening here is that vite tries to parse the json file as javascript and fails. The reason is that this plugin's regex matches .js but also .json. (I don't fully understand the details...) Anyhow, a $ at the end of the regex resolves the issue.

@Himenon
Copy link

Himenon commented Jul 2, 2024

I encountered the same issue. I recommend addressing this bug fix as well.

@joneugster
Copy link

We are hitting this issue in lean4monaco which effectively prevents us from using this package as is. Instead we default to using a modified copy with the change from this PR.

Since this looks like a very small diff, could I ask if there is anything which prevents this from being merged? Is there anything we could do to facilitate the bug fixing?

@AksharX
Copy link

AksharX commented Sep 5, 2024

I have the same problem - I'm not fully understanding the need for this besides for the file node_modules/.vite/deps/assets/webWorkerExtensionHostIframe.html

@CGNonofr
Copy link
Collaborator

Sorry guys, missed those notifications!

@CGNonofr
Copy link
Collaborator

Your PR didn't follow the semantic release convention so I had to rewrite it myself

@CGNonofr CGNonofr closed this Feb 10, 2025
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 this pull request may close these issues.

5 participants