Deno: Deno.bundle() does not handle `export * as` (export-star-as) correctly

Created on 31 Mar 2020  路  9Comments  路  Source: denoland/deno

More details in this repo

bug cli

Most helpful comment

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.

All 9 comments

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.

I can work on this

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

@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.

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...

Related to #5219

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.

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

Closing as resolved

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benjamingr picture benjamingr  路  3Comments

doutchnugget picture doutchnugget  路  3Comments

watilde picture watilde  路  3Comments

ry picture ry  路  3Comments

ry picture ry  路  3Comments