Typescript: Unable to re-export a type with Webpack 4
See original GitHub issueI’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.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:17 (3 by maintainers)
You can still do are-export if it’s clear that you’re exporting a type:
You can also do
export * from "./a";
.@niksumeiko, that cool, but not supported by babel-loader;
export type { IGeocoder } from './types';
crush build withUnexpected token
error