-
Notifications
You must be signed in to change notification settings - Fork 142
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 import sync with dynamic expression #1845
Conversation
The screenshot shows keys with extension. That is fixed. |
Thanks, the output of this transformation looks great. Please remove the BinaryExpression support. It's not always correct (people can use operators other than |
@ef4 i removed the binary expression support |
relativePath = specifier.quasis[0].value.cooked!; | ||
property = specifier.expressions[0]; | ||
} | ||
// babel might transform template form `../my-path/${id}` to '../my-path/'.concat(id) |
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.
I didn't notice before that this stuff is distinct from the BinaryExpression support. I don't think it's correct.
Consider:
importSync(`one${two}three${four}`)
// becomes
importSync("one".concat(two, "three").concat(four));
(It would be even better to figure out how to run before preset-env, but I recognize that this is already in an exit
hook because it's trying to interoperate with other plugins that adjust the import specifiers themselves.)
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.
Right, i only support "one".concat
. this is done by ensuring that the object of the member expression is a string.
one${two}three${four}
is also not supported
No description provided.