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

export {a} from "./b" not handled #18

Open
smhanov opened this issue Mar 25, 2021 · 1 comment
Open

export {a} from "./b" not handled #18

smhanov opened this issue Mar 25, 2021 · 1 comment

Comments

@smhanov
Copy link
Contributor

smhanov commented Mar 25, 2021

bar.ts:

function bar() {
    console.log("bar() is called");
}

foo.ts:

export {bar} from "./bar"

Result:

export { bar } from "./bar";

//# sourceURL=./foo.ts
Uncaught (in promise) TypeError: Error resolving module specifier “./bar”. Relative module specifiers must start with “./”, “../” or “/”.
@klesun
Copy link
Owner

klesun commented Mar 25, 2021

Well, you know what to do =3

Thanks for the issue, would be good to fix that. Not sure I'll get to that anytime soon, though.

I wonder if such exports are, same as imports, limited to only the start of the script. If they are, that would simplify things.

The iteration over top-level statements happens here:

for (const statement of sourceFile.statements) {

I guess the way to go is to console.log out the data structure of these export statements (though not touch other export statements, as they are not limited to start of script), add an else if branch with basically same logic as for ImportDeclaration (should probably move it to a separate function and reuse from both branches) with addition of export { bar }; after the imports block or something like that...

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