-
-
Notifications
You must be signed in to change notification settings - Fork 26
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 string #47
Comments
@BenjaminLesne it looks like this is related to #41. The error is happening because the built library has an object called something like |
I think this static replacement might be the cause. |
@davidmyersdev yeh I saw the Production Replacement thing from vite then I found this It looks like this related to rollup (see this answer) |
I have a react app with the lib mode activated in my vite config.
I use
import.meta.env.mode
then build the app.When I use the library in an other app I get :
Uncaught SyntaxError: Unexpected string
reproducible example repo
steps to reproduce:
1- install dependencies
2- build the library :
3- In main.jsx, uncomment line 4 and comment line 3
4- start the dev server
5- check the console in Chrome
Uncaught SyntaxError: Unexpected string
and the webpage shows nothingExpected behaviour :
The web page displays "yay production" in prod and "not production" in dev mode.
I reproduced it with a Firefox and Chrome.
The text was updated successfully, but these errors were encountered: