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

support dynamic import with variable #213

Closed
hardfist opened this issue May 19, 2022 · 2 comments
Closed

support dynamic import with variable #213

hardfist opened this issue May 19, 2022 · 2 comments
Assignees
Labels
feat New feature or request

Comments

@hardfist
Copy link
Contributor

hardfist commented May 19, 2022

let id = 'abc';
const page = import(id);
@IWANABETHATGUY
Copy link
Contributor

It seems that this feature require us to do some extra work like scope analyze, name resolution? I am not sure if swc has been did such work.
Also should we need to support such dynamic import?

fn a() {
  return 'fs';
}
const page = import(a());

@hyf0 hyf0 added feat New feature or request Design labels May 19, 2022
@hyf0
Copy link
Collaborator

hyf0 commented May 19, 2022

The issue title could be misunderstood. I think we were talking about supporting something like

const page = import('./src/pages/${name}')

We don't actually care about what the real value is of name, which will be decided in runtime.
Its like the glob import of vite.

@hyf0 hyf0 closed this as completed Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants