Using typescript 3.8 export aliases produces an error while building.
Happens with ivy enabled as well as disabled.
npm i ng serveERROR in ./src/app/stuff/index.ts 1:9
Module parse failed: Unexpected token (1:9)
File was processed with these loaders:
* ./node_modules/@ngtools/webpack/src/index.js
You may need an additional loader to handle the result of these loaders.
> export * as fromFoo from './foo';
Angular CLI: 9.1.0-next.3
Node: 12.13.0
OS: win32 x64
Angular: 9.1.0-next.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
@angular-devkit/architect 0.901.0-next.3
@angular-devkit/build-angular 0.901.0-next.3
@angular-devkit/build-optimizer 0.901.0-next.3
@angular-devkit/build-webpack 0.901.0-next.3
@angular-devkit/core 9.1.0-next.3
@angular-devkit/schematics 9.1.0-next.3
@angular/cli 9.1.0-next.3
@ngtools/webpack 9.1.0-next.3
@schematics/angular 9.1.0-next.3
@schematics/update 0.901.0-next.3
rxjs 6.5.4
typescript 3.8.3
webpack 4.42.0
In your project, the "module" compiler flag in tsconfig.json is configured as "esnext". This means that the export is preserved as is, however some part of the toolchain is unable to process that syntax. If you change "module" to "es2015" instead it will work.
Looks like it's Webpack itself that has to support this syntax so that it can work its magic: https://github.com/webpack/webpack/issues/10460
Setting the "module" flag to "es2015" only works, if lazy loading is not used.
```
Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
12 loadChildren: () => import('./features/foo/foo.module').then((m) => m.FooModule)
```
Is there a workaround for this?
Habing same issue as author, setting the module flag as "ES2015" will fix it if not using lazy loading, which does break with this change :/ Subscribing to this issue to know when it is fixed.
Any news yet on this?
This should be fixed in Webpack 5 (https://github.com/webpack/webpack/pull/11117), which is currently in opt-in preview in Angular CLI 11.
See #18820 for more information on how to opt-in Webpack 5.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Setting the
"module"flag to"es2015"only works, if lazy loading is not used.```
Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', or 'umd'.
12 loadChildren: () => import('./features/foo/foo.module').then((m) => m.FooModule)
```