You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
jsakas
changed the title
Defining `global object in vite config breaks any imports with global in their name
Defining global object in vite config breaks any imports with global in their name
Apr 10, 2023
I should add that the reason we even added global: {} was because we are receiving this error:
index.js:19 Uncaught ReferenceError: global is not defined
at ensureCache2 (index.js:19:2)
at ../../node_modules/global-cache/index.js (index.js:29:13)
at __require2 (chunk-TFWDKVI3.js?v=3373edb8:18:50)
at ../../node_modules/react-with-styles-interface-css/dist/index.js (index.js:12:43)
at __require2 (chunk-TFWDKVI3.js?v=3373edb8:18:50)
at ../../node_modules/react-with-styles-interface-css/index.js (index.js:2:18)
at __require2 (chunk-TFWDKVI3.js?v=3373edb8:18:50)
at ../../node_modules/react-dates/lib/utils/registerCSSInterfaceWithDefaultTheme.js
Due to the dependency tree of react-dates -> react-with-styles-interface-css -> global-cache.
Describe the bug
If I add something like this in my Vite config:
And also have some imports with
global
in the name like:The build process fails with this error message:
This only happens in
vite build
, not during development.Reproduction
https://stackblitz.com/edit/vitejs-vite-dzocfw?file=main.js
Steps to reproduce
Run
npm run build
in the terminal in the stackblitz URL.System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages: vite: ^4.3.0-beta.2 => 4.3.0-beta.4
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: