I have angular2 service that must provide tty console to some vm.
How can i import xterm only for this service ?
If i write import { Xterm } from 'xterm'; i get error
ERROR in ./src/app/ttycon.service.ts Module build failed: Error: /var/home/vtolstov/devel/panel/src/app/ttycon.service.ts (2,10): Module '"/var/home/vtolstov/devel/panel/node_modules/@types/xterm/index"' has no exported member 'Xterm'.)
at _checkDiagnostics (/var/home/vtolstov/devel/panel/node_modules/@ngtools/webpack/src/loader.js:116:15)
at /var/home/vtolstov/devel/panel/node_modules/@ngtools/webpack/src/loader.js:141:17
@ ./src/app/ttycon/ttycon.component.ts 11:0-50
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi main
I have installed xterm and @types/xterm
I believe you want:
import { Terminal } from 'xterm';
This is not worked.
May be @types/xterm wrong?
Actually try this one:
import * as xterm from 'xterm'
This is how I import it in vscode:
import xterm = require('xterm');
...
new xterm()
import * as xterm from 'xterm'
Works
Thanks!
@Tyriar How about importing addons?
@Kaijun there is a loadAddon function for node but it's not officially part oft he API yet so it may change across versions (pending #306).
Most helpful comment
import * as xterm from 'xterm'
Works