typescript-notebook
typescript-notebook copied to clipboard
ECMAScript module support?
Does this support the new-style ES modules? (ie. "type": "module"
in package.json
etc.)
I have a Node.js TypeScript project that compiles to native ES modules (recently migrated, due to depending on some other libraries that are now only shipped as ES modules), and I can't seem to be able to import
any of the project's modules in a notebook (inside that project), whichever way I try.
Not yet, but will be supporting that soon. Thanks for trying this extension and submitting the feature request (plan is to get it in some time next week).
Would be really nice if this worked! E.g. right now importing D3 doesn't seem to be possible:
@ilyabo Note that (as a workaround) it should be possible to load ESM from CommonJS using eg.
const d3 = await import('d3');
Reference: https://nodejs.org/api/esm.html#import-expressions
I am getting the same error :(
@ilyabo Ah, I guess the notebook extension's transpiler is also changing import()
function calls into require()
internally...
In this case you are currently probably out of luck, and this issue is indeed a blocker for importing any ES modules.