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

False positives #8

Closed
sapegin opened this issue Sep 4, 2018 · 3 comments
Closed

False positives #8

sapegin opened this issue Sep 4, 2018 · 3 comments

Comments

@sapegin
Copy link
Collaborator

sapegin commented Sep 4, 2018

I found a few false positive cases, where the library replaces imports where it shouldn't. But I'm not sure trying to fix that will be in the scope of the library. Probably I'll just allow imports only at the beginning of the file — they supposed to be hoisted anyway.

const line = "import foo from 'foo'"
const line = 'import foo from "foo"'
const line = `import foo from 'foo'`
<p>import foo from 'foo'</p>
@lukeed
Copy link
Owner

lukeed commented Sep 5, 2018

Hmm we can make it something like ^[\s|\n]import, right? Plus the "is top of file" case.

@sapegin
Copy link
Collaborator Author

sapegin commented Sep 5, 2018

Nah, imagine a multiline string with JS code ;-) We'll never fix all the issues here, and likely make many new ones ;-)

I think we should just document it, and I'm going to try to use AST to find actual import positions and transpile them in place with rewrite-imports.

@lukeed
Copy link
Owner

lukeed commented Sep 5, 2018

Lol okay, pick your battles I guess 😆

sapegin pushed a commit that referenced this issue Oct 12, 2018
@lukeed lukeed closed this as completed in #9 Oct 13, 2018
lukeed pushed a commit that referenced this issue Oct 13, 2018
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

No branches or pull requests

2 participants