Skip to content

Typescript: Unable to re-export a type with Webpack 4 #603

Closed
@renchap

Description

@renchap

I'm submitting a bug report
Webpack Version: 4.4.1
Babel Core Version: 7.0.0-beta.44
Babel Loader Version: 8.0.0-beta.0
Please tell us about your environment:

I am using Bable beta with the typescript preset.

In one file, I define and export a type:

// a.ts
export type MyType = "a" | "b";

In another file, I re-export this type:

// b.ts
export { MyType } from "./a.ts";

Current behavior:

The export line is not present when a.ts is compiled using Babel. The re-export line in b.ts is compiled to:

export { MyType } from "./b";

Webpack fails with this error:

    ERROR in ./app/client/utils.ts
    79:0-51 "export 'myType' was not found in './a'
     @ ./b.ts

Expected/desired behavior:

It worked fine with Webpack 3, I am not sure why.
babel should not output anything for the re-export but it does. I am not sure why Webpack 3 was not complaining about the issue, but now Webpack 4 does.

I am not sure if this should be filled in this repo, or with Webpack or Babel core. I can provide a repro if this is needed and the correct place for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions