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

bundle regression since 1.8.0: module import loss after 3 levels of re-export #10174

Closed
nktpro opened this issue Apr 14, 2021 · 2 comments
Closed
Labels
bug Something isn't working correctly swc related to swc (bundling/transpiling)

Comments

@nktpro
Copy link

nktpro commented Apr 14, 2021

Here's another bizarre deno bundle regression since 1.8.0. Given

first.ts

export const foo = "foo";

second.ts

export * from "./first.ts";

third.ts

export * from "./second.ts";

fourth.ts

import { foo } from "./third.ts";
console.log(foo);

deno bundle ./fourth.ts will produce an invalid output of:

console.log(foo);

Note that foo is gone and is never declared in the output. However, if there are only 2 levels of export, where:

third.ts

import { foo } from "./second.ts";
console.log(foo);

Then deno bundle ./third.ts will produce the correct output of:

const foo = "foo";
console.log(foo);

I could only re-produce this from 1.8.0 onwards, so it seems to be a fairly new regression in swc.

@kitsonk kitsonk added bug Something isn't working correctly swc related to swc (bundling/transpiling) labels Apr 14, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Apr 14, 2021

cc/ @kdy1

kdy1 added a commit to kdy1/swc that referenced this issue Apr 14, 2021
kdy1 added a commit to swc-project/swc that referenced this issue Apr 14, 2021
swc_bundler:
 - Ensure that denoland/deno#10141 is fixed. 
 - Run deno tests on ci.
 - Support nested `export *`. (denoland/deno#10153, denoland/deno#10174)

swc_ecma_codegen:
 - Remove `,` after rest elements. (#1573, denoland/deno#10167)

swc_ecma_transforms_optimization:
 - Don't drop items used by the discriminant of a switch.

swc_ecma_transforms_typescript:
 - Remove constructors without a body.
@kdy1
Copy link

kdy1 commented Apr 14, 2021

Fixed on upstream.

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 swc related to swc (bundling/transpiling)
Projects
None yet
Development

No branches or pull requests

4 participants