Uncaught ReferenceError: __DEFINES__ is not defined
See original GitHub issueI just clone the template and run ‘pnpm i’ and ‘pnpm dev’, and load the extension to chrome, but I get this error
Uncaught ReferenceError: __DEFINES__ is not defined
for the backgound script. This error introduced from this file https://github.com/vitejs/vite/blob/fa30f76e49de0ca8abd96c1fd866da0512ed29b9/packages/vite/src/client/env.ts I try to use yarn and firefox, same error.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Uncaught ReferenceError: define is not defined typescript
This loads RequireJS from 'scripts/require.js' and then tells it to load the script at 'scripts/main.js' to start off the loading process (you' ...
Read more >Getting error "ReferenceError: define is not defined" #1706
In webstorm IDE, I am getting an error when I am using wallaby with requirejs: "ReferenceError: define is not defined".
Read more >"define" is not defined in .js - Coding Help - Glitch Support
I'm getting the error ““define” is not defined” in my .js code, but only in the glitch editor, it seems to work fine...
Read more >Uncaught ReferenceError: define is not defined
Basically $ is an alias of jQuery() so when you try to call/access it before declaring the function, it will endup throwing this...
Read more >ReferenceError: define is not defined at Script Document
i got this error after i upload my main.js which compiled by my typescript files, my tsconfig.json below:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s because that the background script imports
/@vite/client
since this PR, and then Vite will pre-bundle the deps, but, pre-bundling will not replace magic constants such as__DEFINES__
.You can try this workaround:
and then delete Vite’s cache dir
node_modules/.vite
This will be solved in https://github.com/vitejs/vite/pull/4716
I have the some issue with vite v2.9.14 the dev env is ok but the product build is not work.