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

Uncaught ReferenceError: globalThis is not defined in old browsers (Chrome 65) #25368

Closed
radislaw opened this issue Jan 22, 2024 · 1 comment
Closed

Comments

@radislaw
Copy link

Environment

  • Operating System: Linux
  • Node Version: v18.19.0
  • Nuxt Version: 3.9.3
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: yarn@1.22.19
  • Builder: -
  • User Config: devtools
  • Runtime Modules: -
  • Build Modules: -

Reproduction

The Nuxt starter template is enough to reproduce the issue. You just need to open it in Chrome 65

Describe the bug

I'm using the Nuxt starter template. When I run yarn build and then preview in Chrome 65 browser. I get an error in the browser console:
entry.J2zEOy1-.js:13 Uncaught SyntaxError: Unexpected token ?

In order to solve this problem, I use the Vite settings in nuxt.config

 vite: {
        build: {
            target: ['chrome65'],
        },
    }

After restarting yarn build, I get the following error

Uncaught ReferenceError: globalThis is not defined
    at entry.IRimNRDK.js:17

I tried using the plugin @vitejs/plugin-legacy and even nuxt-vite-legacy and separately connect the polyfile for globalThis, but it does not bring any effect, despite the fact that the final Html contains scripts with polyfile and legacy code
image

and there is an error in the console

image

Additional context

No response

Logs

entry-legacy.rwZSLLd-.js:1 Uncaught ReferenceError: System is not defined
    at entry-legacy.rwZSLLd-.js:1
(anonymous) @ entry-legacy.rwZSLLd-.js:1
entry.VwnH7qei.js:17 Uncaught ReferenceError: globalThis is not defined
    at entry.VwnH7qei.js:17
(anonymous) @ entry.VwnH7qei.js:17

The error refers to this code
globalThis.__buildAssetsURL=Gt,globalThis.__publicAssetsURL=m1;
@manniL
Copy link
Member

manniL commented Jan 22, 2024

Hey! Please have a look at #14893 and all the linked issues in there (such as #19328).

We decided last year that we don't support legacy support as part of the core but would be happy to see a module implementation

@manniL manniL closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants