Weird webpack error trying to use xterm.js


#1

I’m trying to use the most recent 2.9.2 version of xterm.js which is written in typescript. I create a new “blank” solution and add it using “npm install xterm --save” - then go to the home.ts file and add:

import { Terminal } from ‘xterm’;

Everything looks good in vscode and it compiles - but when I run it, the code that creates a new Terminal object in ionViewDidLoad() errors out with:

Error: Uncaught (in promise): TypeError: WEBPACK_IMPORTED_MODULE_2_xterm.Terminal is not a constructor

Do I need to do something to tsconfig.json to make this work with ionic? The various things I have tried thus far haven’t worked, so I thought I’d ask around.


#2

See: https://stackoverflow.com/questions/45516093/ionic-3-using-javascript-library-xterm-js/45557432#45557432


#3

Yes - i saw that - unfortunately that project was done before they switched xterm.js to typescript - i think the problem will be resolved in a few days when the they release the v3 version of xterm.js - it looks like many things TS related were in flux in the 2.9.x releases.