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.

Angular 8 - global is not defined

See original GitHub issue

I recently migrated an Angular 7 application (that was using chartist) to Angular 8. After migration the app no longer works with the following error in console: Uncaught ReferenceError: global is not defined at chartist.js:1173 Screenshot from 2019-09-21 19-01-28

chartist version 0.11.4

It seems that Angular CLI removed shim for global https://github.com/angular/angular-cli/issues/8160#issuecomment-386153833 reasoning here: https://github.com/angular/angular-cli/issues/9827#issuecomment-369578814 and library authors should not rely on it any more.

workaround mentioned in first linked issue works, but its still just a workaround that is mentioned nowhere in chartist documentation (and ideally should not be required)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
blueskyfishcommented, Sep 21, 2019

I found this walk around:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>TestApp</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <script>
      window.global = window;
  </script>
</head>
<body>
<app-route></app-root>
</body>
</html>
1reaction
dansopercommented, Nov 5, 2019

This has just affected a project I’m working on - I’ve had to lock myself to Chartist 0.11.0 until it’s fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular 8 to Angular 9, report 'global is not defined' error in ...
Description. I upgraded my angular 8 project to angular 9 using angular cli script: ng update @angular/cli @angular/core.
Read more >
Upgrading to angular-6.x gives "Uncaught ReferenceError
Then you're getting the following error Fix: "Uncaught ReferenceError: global is not defined" do it as follows node: { global: true, ...
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?...
Read more >
Uncaught ReferenceError: global is not defined - YouTube
Uncaught ReferenceError: global is not defined at node_modules/@walletconnect/socket-transport/dist/esm/index.jscreate a n ew filw named ...
Read more >
Uncaught ReferenceError: Angular is not defined
js file in your index.html file. Angular not defined pretty much means that the library is not loaded properly from the server. We...
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