DonJayamanne / typescript-notebook

Run JavaScript and TypeScript in node.js within VS Code notebooks with excellent support for debugging, tensorflowjs visulizations, plotly, danfojs, etc
https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook
MIT License
904 stars 39 forks source link

Relative imports work during execution but not when editing #49

Open dinofx opened 2 years ago

dinofx commented 2 years ago

In a typescript notebook cell, if I have code like:

import { main } from './my-module';
main();

Where my-module.ts is a sibling file to the notebook, typescript is unable to resolve the module at edit time. Executing the cell works fine.

For some reason, something like this works at edit-time, but fails obviously at evaluation:

import { main } from '../../../../../../my-module';
main();

I don't remember the exact number of ../s required, but typescript seems to think the "current" module is deeply nested in the workspace somewhere.