Skip to content

Commit

Permalink
Fix globalthis (#1420)
Browse files Browse the repository at this point in the history
* fix: return empty object for globalthis

* chore: commit changeset
  • Loading branch information
xiaoiver authored Jul 18, 2023
1 parent 6fa21f8 commit ff2f458
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .changeset/honest-falcons-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@antv/g-plugin-canvas-renderer': patch
'@antv/g-plugin-device-renderer': patch
'@antv/g-plugin-canvas-picker': patch
'@antv/g-lite': patch
---

Return empty object for globalthis.
2 changes: 1 addition & 1 deletion packages/g-lite/src/global-runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ const getGlobalThis = () => {
if (typeof window !== 'undefined') return window;
// @ts-ignore
if (typeof global !== 'undefined') return global;
return {};
// [!] Error: The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
// @see https://rollupjs.org/troubleshooting/#error-this-is-undefined
// if (typeof this !== 'undefined') return this;
throw new Error('Unable to locate global `this`');
};

/**
Expand Down

0 comments on commit ff2f458

Please sign in to comment.