Skip to content

Commit

Permalink
added globalthis as a feature
Browse files Browse the repository at this point in the history
  • Loading branch information
alshdavid committed Aug 18, 2023
1 parent 4c21ef7 commit 3ee570e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/core/core/src/public/Environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ const supportData = {
and_qq: '12.12',
op_mob: '64',
},
'global-this': {
chrome: '75',
edge: '79',
safari: '12.1',
firefox: '65',
opera: '58',
node: '12',
and_chr: '71',
ios: '12.2',
android: '71',
samsung: '10.1',
},
};

const internalEnvironmentToEnvironment: WeakMap<
Expand Down
3 changes: 2 additions & 1 deletion packages/core/types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ export type EnvironmentFeature =
| 'worker-module'
| 'service-worker-module'
| 'import-meta-url'
| 'arrow-functions';
| 'arrow-functions'
| 'global-this';

/**
* Defines the environment in for the output bundle
Expand Down
2 changes: 1 addition & 1 deletion packages/packagers/js/src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function $parcel$interopDefault(a) {
`;

const $parcel$global = (env: Environment): string => {
if (env.supports('esmodules')) {
if (env.supports('global-this')) {
return `
var $parcel$global = globalThis;
`;
Expand Down

0 comments on commit 3ee570e

Please sign in to comment.