Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any way to set tsconfig.json or other properties? #63

Open
yatharth opened this issue Dec 27, 2021 · 3 comments
Open

Any way to set tsconfig.json or other properties? #63

yatharth opened this issue Dec 27, 2021 · 3 comments

Comments

@yatharth
Copy link

Steps to reproduce

  1. Start Jupyter Lab in /Users/yatharth/projectDir/
  2. Inside Jupyter Lab, create Typescript or Javascript notebook inside ``/Users/yatharth/projectDir/otherFolder`
  3. Inside notebook, try to do import myFile as '../myFolder/myFile'

Expected Result

The import works.

Actual Result

There’s an error.

3:33 - File '/Users/yatharth/projectDir/myFolder/myFile.ts' is not under 'rootDir' '/Users/yatharth/projectDir/myFolder'

Implications

Can you really not import modules outside the current notebook’s directory? This seems surprising.

Potential solutions

It seems like the rootDir Typescript uses is set to the notebook’s directory. Maybe it would be better set to the initial directory that Jupyter Lab was started in or is serving from.

@wei3erHase
Copy link

wei3erHase commented Jan 22, 2022

yo @yatharth have you had some workaround for this issue?
apparently @yunabe will not work anymore in this repo.

@yatharth
Copy link
Author

yatharth commented Jan 23, 2022

yo @yatharth have you had some workaround for this issue?

No, I just start tslab in a higher director to avoid this.

apparently @yunabe will not work anymore in this repo.

Really? Where did they say that?

@wei3erHase
Copy link

@yatharth i've found a cleaner workaround.

let's say you want to import from ./myFolder and you get the error you showed
then you can do:

cd node_modules
ln -s ../myFolder @myFolder

and later import from @myFolder (as it were a node package)

the script above will create a system link inside your node_modules folder

i've made lot's of tests with the tsconfig.json and tslab is apparently wholly ignoring it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants