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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy loaded libraries stopped working after update to 7.3 #13793

Closed
piernik opened this issue Feb 28, 2019 · 2 comments
Closed

Lazy loaded libraries stopped working after update to 7.3 #13793

piernik opened this issue Feb 28, 2019 · 2 comments

Comments

@piernik
Copy link

piernik commented Feb 28, 2019

馃悶 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 7.2

Description

I did update using ng update --all --force=true (had to use --force=true because update wanted to install typescript@3.3.3333 which was not allowed (<3.3)).

After updating ng serve stopped working throwing:

ERROR in ./src/app/utils/lazy-loading.ts 71:49
Module parse failed: Unexpected token (71:49)
You may need an appropriate loader to handle this file type.
|             return __generator(this, function (_a) {
|                 switch (_a.label) {
>                     case 0: return [4 /*yield*/, import('zxcvbn').then(function (resp) {
|                             return resp.default;
|                         })];

Here is my code for lazy loading external libs:

export class LazyLoading {
  static async loadZXCVBN(): Promise<any> {
    const zxcvbn = await import ('zxcvbn').then(resp => {
      return resp.default;
    });
    return zxcvbn;
  }
}

Here is my tsconfig (nothing changed):

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    //    "module": "es2015",
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "resolveJsonModule": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ],
    "paths": {
      "@app/*": [
        "src/app/*"
      ],
      "@mocks/*": [
        "src/mocks/*"
      ],
      "@decorators/*": [
        "src/app/utils/decorators/*"
      ]
    }
  }
}

Can someone give me a fast solution?

馃敩 Minimal Reproduction

馃敟 Exception or Error


ERROR in ./src/app/utils/lazy-loading.ts 71:49
Module parse failed: Unexpected token (71:49)
You may need an appropriate loader to handle this file type.
|             return __generator(this, function (_a) {
|                 switch (_a.label) {
>                     case 0: return [4 /*yield*/, import('zxcvbn').then(function (resp) {
|                             return resp.default;
|                         })];

馃實 Your Environment





Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.3
@angular-devkit/build-angular     0.13.3
@angular-devkit/build-optimizer   0.13.3
@angular-devkit/build-webpack     0.13.3
@angular-devkit/core              7.2.3
@angular-devkit/schematics        7.2.3
@angular/.cdk.MODULES             
@angular/cdk                      7.3.3
@angular/cli                      7.3.3
@ngtools/webpack                  7.3.3
@schematics/angular               7.2.3
@schematics/update                0.13.3
rxjs                              6.4.0
typescript                        3.2.4
webpack                           4.29.0


Anything else relevant?

@alan-agius4
Copy link
Collaborator

Duplicate of #13767

@alan-agius4 alan-agius4 marked this as a duplicate of #13767 Feb 28, 2019
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants