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

More statically analyzable dynamic imports #275

Closed
lucacasonato opened this issue Jun 1, 2023 · 0 comments · Fixed by #334
Closed

More statically analyzable dynamic imports #275

lucacasonato opened this issue Jun 1, 2023 · 0 comments · Fixed by #334
Labels
enhancement New feature or request

Comments

@lucacasonato
Copy link
Member

Right now deno_graph can include completely statically analyzable dynamic imports in the module graph. These are dynamic import calls that are passed a string literal (e.g. await import("./cli")).

I propose to extend this to include simple dynamic cases, like await import(`./islands/${path}`). This would include all files under ./islands/ in the module graph.

This would only work in files where import.meta.url is file:///, because remote specifiers can not be listed.

This is modeled after a similar feature in Vite: https://vitejs.dev/guide/features.html#dynamic-import.

Unlike Vite, we should support nested directories. We should bail on symlinks, and should bail when we the # of matched modules exceeds some predefined limit, like 1024.

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

Successfully merging a pull request may close this issue.

1 participant