-
Notifications
You must be signed in to change notification settings - Fork 920
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
[FEATURE] Transform complex dynamic imports #2861
Comments
I wonder if we could combine #2900 and #2881, expand the We could also speed up the lexer by only scanning forward from |
Also this particular use case might be solved by our upcoming // writing the following
const langs = import.meta.glob(`../locales/*.json`);
// should produce
const langs = {
'../locales/en.json': () => import('../locales/es.json.proxy.js'),
'../locales/es.json': () => import('../locales/es.json.proxy.js')
} |
Oh interesting! What if we just added a warning when we saw a complex dynamic import, telling you to use |
|
The problem that you want to solve.
Issue reported here: #2840
We should be able to transform:
Your take on the correct solution to problem.
We could add some advanced handling to our internal transform utility to parse the expression inside of a dynamic import into an AST (with something like acorn) or even something simpler like Regex. Then, we could transform the template string based on its raw parts.
Are you willing to submit a pull request to implement this change?
This is a little tricky, but fairly self contained / a good place to start if you're looking to contribute to Snowpack!
The text was updated successfully, but these errors were encountered: