Skip to content

Commit

Permalink
🐛 Catch undefined globalThis in bundles (#234)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wil Wilsman authored Mar 10, 2021
1 parent 1b228f6 commit f925efb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const base = {
...pkg.rollup.output,
intro: [
// provide the bundle with a fake process.env if needed
'const process = globalThis.process || {};',
'let process = {};',
'try { process = globalThis.process || {}; } catch (e) {}',
'process.env = process.env || {};',
// signals that the package is running in a browserified bundle
'process.env.__PERCY_BROWSERIFIED__ = true;'
Expand Down

0 comments on commit f925efb

Please sign in to comment.