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

Incorrect import conversion #3

Closed
getify opened this issue Jul 18, 2020 · 0 comments
Closed

Incorrect import conversion #3

getify opened this issue Jul 18, 2020 · 0 comments

Comments

@getify
Copy link
Owner

getify commented Jul 18, 2020

var x = require("..").another()

Currently becomes:

import { another as _imp } from "..";
var x = _imp();

It should be:

import _imp from "..";    // or:   import * as _imp from "..";
var x = _imp.another();

This strange behavior is because a require(..).whatever is a recognized MemberExpression, but itself can be the callee of a CallExpression. It might technically work the way it currently is, but it's pretty unintuitive. I think the specificity of trying to import the named-export (another), instead of the whole module/namespace, is the problem, and should be pulled back.

@getify getify mentioned this issue Jul 18, 2020
12 tasks
@getify getify closed this as completed in 025063c Jul 19, 2020
getify added a commit that referenced this issue Jul 19, 2020
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

1 participant