NodeRED
I am looking to use the xterm.js library from https://xtermjs.org/, which I installed with the command npm install xterm
.
I would like to use the template node to run the following code but I do not know how to import the xterm.js library.
<link rel="stylesheet" href="what-path-do-i-use/xterm/css/xterm.css" />
<script src="what-path-do-i-use/xterm/lib/xterm.js"></script>
<div id="terminal"></div>
<script>
var term = new Terminal();
term.open(document.getElementById('terminal'));
term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
</script>
I used docker-compose to launch the project:
docker-compose.yml
version: "3.7"
services:
node-red:
image: nodered/node-red:latest
user: root
environment:
- TZ=America/New_York
ports:
- "1880:1880"
networks:
- node-red-net
volumes:
- .node-red-data:/data
networks:
node-red-net:
Not looking to CDN
A CDN link like below is a temp solution, but there should be a way to reference npm modules libraries.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/xterm/3.14.5/xterm.min.js"></script>