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

Experiment with allowing absolute paths for imports in core #236653

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Dec 19, 2024

For #236644

Quickly hacked this together to allow #/vs/ absolute imports. This only works for dev right now

@bpasero @jrieken Let me know if this is something we would like to look into further

@mjbvz mjbvz self-assigned this Dec 19, 2024
@bpasero
Copy link
Member

bpasero commented Dec 20, 2024

@mjbvz hm interesting, but:

  • how does this work for auto imports that TS generates, they would be relative, no?
  • not a very big fan of a leading # in imports, I prefer the relative imports in this case
  • we also need to support VS Code for web, where we have a CSS dev service as well

@jrieken
Copy link
Member

jrieken commented Jan 6, 2025

@mjbvz Where does the #<somepath> syntax come from? Is that some JS/browser standard?

@mjbvz
Copy link
Collaborator Author

mjbvz commented Jan 8, 2025

Good questions @bpasero and @jrieken :

  • TS will emit the path as written (#vs/...). So our runtime environments also need to handle understand this style of import. That's why the changes in setupDevImportMaps and the package.json are also needed

  • The # is a node convention. As far as I know browsers do not have a similar convention. Starting imports with # makes it clear that these paths are not for an external module. Here's the relevant docs: https://nodejs.org/api/packages.html#subpath-imports

  • I think that already should work but let me double check

@jrieken
Copy link
Member

jrieken commented Jan 8, 2025

The # is a node convention. As far as I know browsers do not have a similar convention.

I am really skeptical about that. We have just left the custom AMD world behind us and use plain, standard JS now. So, this feels like buying into the next custom thing

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

Successfully merging this pull request may close these issues.

5 participants