Skip to content

Error while using typescript 3.8 export aliases聽#17231

Closed

Description

@TomTomB

馃悶 bug report

Description

Using typescript 3.8 export aliases produces an error while building.
Happens with ivy enabled as well as disabled.

馃敩 Minimal Reproduction

  1. Clone the error repo https://github.com/TomTomB/named-exports-issue
  2. Run npm i
  3. Run ng serve
  4. Look inside the terminal output

馃敟 Exception or Error

ERROR 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';

馃實 Your Environment

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

Package Version

@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

Activity

  1. JoostK commented on Mar 15, 2020

    @JoostK
    Member

    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.

  2. JoostK commented on Mar 15, 2020

    @JoostK
    Member

    Looks like it's Webpack itself that has to support this syntax so that it can work its magic: webpack/webpack#10460

  3. TomTomB commented on Mar 15, 2020

    @TomTomB
    Author

    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)
    
  4. added this to the needsTriage milestone on Mar 16, 2020
  5. added
    featureLabel used to distinguish feature request from other issues
    on Mar 16, 2020
  6. modified the milestones: needsTriage, Backlog on Mar 16, 2020
  7. added
    freq1: lowOnly reported by a handful of users who observe it rarely
    and removed
    featureLabel used to distinguish feature request from other issues
    on Mar 22, 2020
  8. modified the milestones: Backlog, needsTriage on Mar 22, 2020
  9. modified the milestones: needsTriage, Backlog on Mar 22, 2020
  10. troywweber7 commented on May 15, 2020

    @troywweber7

    Is there a workaround for this?

  11. KingDarBoja commented on Sep 6, 2020

    @KingDarBoja

    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.

  12. brianpooe commented on Oct 15, 2020

    @brianpooe

    Any news yet on this?

  13. alan-agius4 commented on Oct 15, 2020

    @alan-agius4
    Collaborator

    This should be fixed in Webpack 5 (webpack/webpack#11117), which is currently in opt-in preview in Angular CLI 11.

    See #18820 for more information on how to opt-in Webpack 5.

  14. angular-automatic-lock-bot commented on Nov 15, 2020

    @angular-automatic-lock-bot

    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.

  15. locked and limited conversation to collaborators on Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions