Hi
I have solved the problem I posted above, but with one problem which prevent me from working with Framework offline.
I have made my original question (as described above) working by removing prism.js and only using highlight.js by simply importing like below
import hljs from 'https://cdn.skypack.dev/highlight.js';
As you can see, it won’t work if I go offline, unless I can use the highlight.js already inside Node_modules folder. However, when I try to import explicitly highlight.js. I tried the following but all returned the similar error of fetch failed.
import hljs from "npm: highlightjs";
import hljs from "npm: highlight.js";
import hljs from "npm: highlight";
All these three attempts failed with similar messages like below inside the terminal
GET /noise01
npm:highlightjs → GET /noise01
TypeError: fetch failed
at node:internal/deps/undici/undici:12443:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///Users/Natsume/Documents/Processing/my_projects/kennynoc/node_modules/@observablehq/framework/dist/npm.js:193:22 {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:7595:28)
at node:internal/deps/undici/undici:7551:50
at Immediate._onImmediate (node:internal/deps/undici/undici:7583:13)
at process.processImmediate (node:internal/timers:478:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
TypeError: fetch failed
at node:internal/deps/undici/undici:12443:11
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///Users/Natsume/Documents/Processing/my_projects/kennynoc/node_modules/@observablehq/framework/dist/npm.js:193:22 {
cause: ConnectTimeoutError: Connect Timeout Error
at onConnectTimeout (node:internal/deps/undici/undici:7595:28)
at node:internal/deps/undici/undici:7551:50
at Immediate._onImmediate (node:internal/deps/undici/undici:7583:13)
at process.processImmediate (node:internal/timers:478:21) {
code: 'UND_ERR_CONNECT_TIMEOUT'
}
}
Why does Framework fetch highlight.js online? why it always fail? How can I import it explicitly and be able to use it when offline.