-
-
Notifications
You must be signed in to change notification settings - Fork 587
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
fix(dynamic-import-vars): allow ./${var}.suffix.js #834
fix(dynamic-import-vars): allow ./${var}.suffix.js #834
Conversation
Allow dynamically importing files in the same directory with an extra suffix before the extension.
This effectively disables the check. I think it's better to add an option which allows these kinds of imports, although they're quite dangerous because the glob will match your current file as well. |
My assumption was that if But! For my specific use-case I discovered that Stencil provides a tree-shakable, non-lazy-loading build, so I'm unblocked. Feel free to close or amend this however you like. Thanks for the review! |
Ah I see, do we allow |
// not allowed
import(`./${foo}.js`);
// allowed
import(`./module-${foo}.js`); what's tripping me up is that the Stencil file output is is |
@LarsDenBakker @danielgindi @tjenkinson gentle ping for review |
@LarsDenBakker @danielgindi @tjenkinson another gentle ping. I'm inclined to move this one forward. |
Looks good to me and makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM as well. sorry haven't been spending a lot of time on open source lately
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Thank you! |
Allow dynamically importing files in the same directory with an extra suffix before the extension.
Allow dynamically importing files in the same directory with an extra suffix before the extension.
* fix(dynamic-import-vars): allow ./${var}.suffix.js (#834) Allow dynamically importing files in the same directory with an extra suffix before the extension. * enforce `prettier` is happy on CI * run prettier on more things in precommit and do not pass `--single-quote` to use the value in the config * run `pnpm run prettier` * remove redundant `--plugin` option because it will be loaded automatically given it's in the config * chore: add changelogs to docs lint Co-authored-by: Lenny Burdette <lennyburdette@gmail.com> Co-authored-by: Andrew Powell <shellscape@users.noreply.github.com> Co-authored-by: shellscape <andrew@shellscape.org>
Rollup Plugin Name:
dynamic-import-vars
This PR contains:
Are tests included?
Breaking Changes?
If yes, then include "BREAKING CHANGES:" in the first commit message body, followed by a description of what is breaking.
List any relevant issue numbers:
Description
Allow dynamically importing files in the same directory with an extra suffix before the extension.
My motivating example is trying to import a library generated with Stencil. It generates a dynamic import that looks like this:
My interpretation of the README suggests this should be possible. I changed the assertion for "Imports to your own directory must specify a filename pattern" to a stricter regex. I'm happy to change the implementation if regexes aren't desired.
Thanks!