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

Babel plugin: Fixed bug when using + concatenation instead of a template literal #425

Merged
merged 2 commits into from
Sep 19, 2019

Conversation

mbrowne
Copy link
Contributor

@mbrowne mbrowne commented Sep 4, 2019

Summary

Currently, the Babel plugin successfully transpiles template literals, but doesn't work when building a string using +. i.e. this works:

import(`my-lib/${componentId}`)

But this does not:

import('my-lib/' + componentId)

The latter fails with an error:

TypeError: Property value expected type of string but got null

This PR fixes this issue by checking to see if the import expression is a BinaryExpression. I'm not sure if there are any other types of expressions that should be checked for, but this solves the issue for BinaryExpressions at least.

Test plan

I added a new test to verify that it works and also tested it in a real app.

@theKashey
Copy link
Collaborator

👍

@gregberge gregberge merged commit d98dd27 into gregberge:master Sep 19, 2019
@gregberge
Copy link
Owner

Thanks!

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

Successfully merging this pull request may close these issues.

3 participants