Skip to content
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

global is not defined on Vite #190

Closed
Tracked by #480
antfu opened this issue Nov 11, 2021 · 2 comments
Closed
Tracked by #480

global is not defined on Vite #190

antfu opened this issue Nov 11, 2021 · 2 comments
Assignees
Labels
bridge bug Something isn't working

Comments

@antfu
Copy link
Member

antfu commented Nov 11, 2021

Environment

The test/fixture/bridge


  • Operating System: Darwin
  • Node Version: v16.11.1
  • Nuxt Version: 2.15.8
  • Package Manager: yarn@3.1.0
  • Bundler: Webpack
  • User Config: components, serverMiddleware, buildDir, plugins, nitro, bridge, buildModules
  • Runtime Modules: -
  • Build Modules: @nuxt/bridge@3.0.0

Describe the bug

cd test/fixtures/bridge
TEST_BRIDGE_VITE=1 yarn dev

Visit the app, and get the error in the console

image

It comes from Nuxt 2's entry file.

Reproduction

Additional context

I guess a quick solution is injecting this on dev:

if (typeof global === 'undefined')
  globalThis.global = globalThis

Logs

No response

@antfu antfu added bug Something isn't working bridge labels Nov 11, 2021
@pi0 pi0 self-assigned this Nov 11, 2021
@tobiasdiez
Copy link
Contributor

This is now fixed for me.

@pi0
Copy link
Member

pi0 commented Nov 15, 2021

Only use by Nuxt internals resolved by (#1866). Moving enhancement to prevent this issue to nuxt/nuxt#12830

@pi0 pi0 closed this as completed Nov 15, 2021
@pi0 pi0 transferred this issue from nuxt/framework Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bridge bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants