njs icon indicating copy to clipboard operation
njs copied to clipboard

Support ES Module: import fs from 'njs:fs';

Open PassionPI opened this issue 1 year ago • 1 comments

It's possible to import the njs module like this?

import fs from 'njs:fs'; or
import fs from 'nginx:fs';

Describe the solution you'd like

Import all modules that are not web standards but are supported by Nginx.

import fs from 'njs:fs'; import zlib from 'njs:zlib'; ...

Describe alternatives you've considered

In other JS runtimes, it is common to import modules using specific prefixes, for example, import path from "node:path".

PassionPI avatar Dec 11 '24 09:12 PassionPI

Hi @PassionPI,

No, it is not supported yet. But, it looks like a good improvement. Will do.

xeioex avatar Dec 12 '24 01:12 xeioex