Skip to content

Commit

Permalink
fix: use globalThis instead of self to address non Browser consumption
Browse files Browse the repository at this point in the history
Currently using this package in a non Browser env will cause an error as Webpack will emit `self` which does not exist in all envs such as Node.js and Workers.

This commit updates Webpack and force it to use `globalThis`. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis
  • Loading branch information
alan-agius4 authored Oct 30, 2023
1 parent 9fff1e6 commit de1304d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const config = {
output: {
filename: 'xterm.js',
path: path.resolve('./lib'),
libraryTarget: 'umd'
libraryTarget: 'umd',
// Force usage of globalThis instead of global / self. (This is cross-env compatible)
globalObject: 'globalThis',
},
mode: 'production'
mode: 'production',
};
module.exports = config;

0 comments on commit de1304d

Please sign in to comment.