Skip to content

Commit 0e1d736

Browse files
Update XtermAddon.ts
1 parent 243c707 commit 0e1d736

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/lib/XtermAddon.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,19 @@ export class XtermAddon {
3535

3636
/**
3737
* Dynamically imports the 'ligatures' addon from `@xterm/addon-ligatures`.
38+
*
39+
* This addon is designed to be used in environments with access to Node.js APIs (such as Electron).
40+
*
3841
* @returns A promise that resolves to the 'ligatures' addon module.
3942
*/
40-
static LigaturesAddon = async () => await import('@xterm/addon-ligatures');
43+
static LigaturesAddon = async () => {
44+
if (typeof process === 'undefined' || process.versions == null || process.versions.node == null) {
45+
// This is not a Node.js environment
46+
throw new Error('This module can only be imported in a Node.js environment');
47+
}
48+
49+
return await import('@xterm/addon-ligatures');
50+
}
4151

4252
/**
4353
* Dynamically imports the 'search' addon from `@xterm/addon-search`.

0 commit comments

Comments
 (0)