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

Deno.bundle() does not handle export * as (export-star-as) correctly #4542

Closed
KSXGitHub opened this issue Mar 31, 2020 · 9 comments
Closed
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@KSXGitHub
Copy link
Contributor

More details in this repo

@kitsonk
Copy link
Contributor

kitsonk commented Mar 31, 2020

This is a bug. I think we missed this export pattern when we do the analysis of the exported nodes for the module and don't properly resolve the symbol names.

@kitsonk kitsonk mentioned this issue Mar 31, 2020
18 tasks
@grosto
Copy link
Contributor

grosto commented Apr 8, 2020

I can work on this

@grosto
Copy link
Contributor

grosto commented Apr 10, 2020

Could it be bug with typescript?
It seems that bundle is not emitting System.regiter for './a' and './b', and this seems to be done on typescript side
https://github.com/KSXGitHub/deno-issue-bundle-export-star-as/blob/master/bundle.js#L89

@kitsonk
Copy link
Contributor

kitsonk commented Apr 11, 2020

@grosto actually, I probably need to take a look into it further. It might or might not be TypeScript. The problem is the main module is JavaScript, so that works a bit differently, and it feels like we might not be setting up right when the main module is JS and we are bundling, which means the issue has nothing to do with the export * and has everything to do with bundling a JavaScript module as the main module.

@gewoonwoutje
Copy link
Contributor

gewoonwoutje commented May 18, 2020

While waiting for a fix, here is an ugly workaround: use import * as from the file also.

For instance:

// external.ts
// This file contains the imports of external source from URLs.

import * as Oak from "https://deno.land/x/oak/mod.ts";
export * as Oak from "https://deno.land/x/oak/mod.ts";

and

// src/main.ts
import { Oak } from '../external.ts';

It shows up as an unused import in VS Code, but it does fix bundling.
image

EDIT: It only fixes bundling for first class dependencies. It fails when dependencies also use export * as...

@gewoonwoutje
Copy link
Contributor

Related to #5219

@kitsonk
Copy link
Contributor

kitsonk commented Jun 21, 2020

I am unable to reproduce now on Deno 1.1.1. I cloned the repo and updated to the proper version of std. I suspect there were fixes in TypeScript 3.9 that fixed this issue (as I believe there were some bugs related to export * as).

This can be closed now.

@katywings
Copy link

@kitsonk I gonna try it out with my prototype as well then 🙂

@bartlomieju
Copy link
Member

Closing as resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

No branches or pull requests

6 participants