Skip to content

Uncaught SyntaxError: Unexpected string #47

Closed
@BenjaminLesne

Description

@BenjaminLesne

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

pnpm install

2- build the library :

pnpm build

3- In main.jsx, uncomment line 4 and comment line 3

4- start the dev server

pnpm dev

5- check the console in Chrome
Uncaught SyntaxError: Unexpected string and the webpage shows nothing

Expected behaviour :
The web page displays "yay production" in prod and "not production" in dev mode.

I reproduced it with a Firefox and Chrome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions