question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

global is not defined

See original GitHub issue

Bug report

ReferenceError: global is not defined

Version

0.14.0

Steps to reproduce

so i install the modules - file-saver,but when i import it in my project, the chrome throw the error: global is not defined

i import it like this: import FileSaver from 'file-saver'

image

What is expected?

i hope i can use the file-saver normaly;

What is actually happening?

it doesn’t work

Other relevant information

  • Your OS: mac
  • Node.js version: 10.0
  • Browser version:
  • Is this a global or local install? yarn add file-saver
  • Which package manager did you use for the install? yarn
  • Does this issue occur when all plugins are disabled? no

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
cdauthcommented, Apr 8, 2021

I’m having the same problem and really don’t understand what’s going on.

I managed to build a workaround for it by using window.global = window in enhanceApp.js. However, since this has to run before the imports, I have to use require instead of import:

if (typeof window !== "undefined")
    window.global = window;
const qrcode = require("vue-qrcode").default;
2reactions
lilisakocommented, Feb 20, 2020

How did you solve this? I’m having a same issue…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: global is not defined #2141 - GitHub
ncaught ReferenceError : global is not defined at Object../node_modules/buffer/index.js (index.js:43) at webpack_require (bootstrap:76)
Read more >
How to fix the ReferenceError: global is not defined error in ...
That sound simple enough to fix, just create a vite.config.[js/ts] file, add it to your SvelteKit project and define global right? // vite....
Read more >
Angular 7: Uncaught ReferenceError: global is not defined ...
When I googled it everyone says to add this (window as any).global = window; to pollyfills.ts I have done this and I still...
Read more >
Node.js – Angular 7: Uncaught ReferenceError: global is not ...
Node.js – Angular 7: Uncaught ReferenceError: global is not defined when adding package ... When I googled it everyone says to add this...
Read more >
react global is not defined | The AI Search Engine You Control
Installing and importing react-dates results in this error: Uncaught ReferenceError: global is not defined since react-dates has some dependencies that use ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found