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

Uncaught ReferenceError: __importDefault is not defined #32215

Closed
akolybelnikov opened this issue Aug 20, 2019 · 19 comments
Closed

Uncaught ReferenceError: __importDefault is not defined #32215

akolybelnikov opened this issue Aug 20, 2019 · 19 comments
Labels
area: compiler Issues related to `ngc`, Angular's template compiler freq2: medium type: bug/fix
Milestone

Comments

@akolybelnikov
Copy link

馃悶 bug report

Affected Package

The issue is caused by package @angular/...."9.0.0-next.2"

Is this a regression?

Yes, the previous version in which this bug was not present was: @angular/...."8.0.0"

Description

App compiles with ng serve but is not being loaded in the browser with the above error referring to a line in the components metadata:
templateUrl: './login.component.html',

馃敩 Minimal Reproduction

https://github.com/akolybelnikov/repro-issue-ng-9

馃敟 Exception or Error


(In Chrome: )Uncaught ReferenceError: __importDefault is not defined

(In Safari: ) ReferenceError: Can't find variable: __importDefault

馃實 Your Environment

Angular Version: 9.0.0-next.2


Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.803.0-rc.0
@angular-devkit/build-angular      0.803.0-rc.0
@angular-devkit/build-ng-packagr   0.803.0-rc.0
@angular-devkit/build-optimizer    0.803.0-rc.0
@angular-devkit/build-webpack      0.803.0-rc.0
@angular-devkit/core               8.3.0-rc.0
@angular-devkit/schematics         8.1.1
@angular/cdk                       8.1.3
@angular/cli                       8.3.0-rc.0
@angular/material                  8.1.3
@angular/pwa                       0.803.0-rc.0
@ngtools/webpack                   8.3.0-rc.0
@schematics/angular                8.3.0-rc.0
@schematics/update                 0.803.0-rc.0
ng-packagr                         5.5.0
rxjs                               6.5.2
typescript                         3.7.0-dev.20190820
webpack                            4.39.2

Anything else relevant?
MacOS

@AndrewKushnir AndrewKushnir added the area: compiler Issues related to `ngc`, Angular's template compiler label Aug 20, 2019
@ngbot ngbot bot added this to the needsTriage milestone Aug 20, 2019
@alxhub alxhub added comp: ivy area: compiler Issues related to `ngc`, Angular's template compiler type: bug/fix freq2: medium and removed area: compiler Issues related to `ngc`, Angular's template compiler comp: ngcc labels Aug 20, 2019
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Aug 20, 2019
@supzfly
Copy link

supzfly commented Aug 26, 2019

Just been updating my cli and am now getting the same error.

Previously worked with v7

@hbod8
Copy link

hbod8 commented Aug 30, 2019

I'm having the same problem after updating the CLI.

@xriu
Copy link

xriu commented Sep 2, 2019

For me, the fix was just downgrade typescript package (3.4.5 works fine)

@kschwidder
Copy link

Happens also with the latest 8.x release !
Downgraded TypeScript to 3.5.3 which fixes it. TypeScript 3.6.x is buggy !

@furmanvit
Copy link

Happens also with the latest 8.x release !
Downgraded TypeScript to 3.5.3 which fixes it. TypeScript 3.6 is buggy !

I cant downgrade tsc version, because in ng --version its always shows me 3.6.4. I can only change tsc globally and in local project, but in package Angular CLI (ng --version) it still shows me the newest version of typescript. Do you know, how to downgrade tsc dicectly in Angular CLI package?

@kschwidder
Copy link

kschwidder commented Oct 11, 2019

I just updated package.json such that typescript points to 3.5.3 and did an npm install. That's it.

@pcz4489
Copy link

pcz4489 commented Oct 18, 2019

Because my TypeScript version cannot be downgraded, I have overridden this method.
by use in my html script tag:
var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }
and it works, Reference link. See what's '--esModuleInterop' do.

@Undrium
Copy link

Undrium commented Oct 29, 2019

Time to get this one up a tad bit; Angular 9.0.0-next.14 actually requires typescript between 3.6.4 and 3.7.0, causing a huge problem with the template imports as this is caused by TS 3.6.4 or higher. zengpl's solution, one message up, works but is really ugly.

@akolybelnikov
Copy link
Author

I have just updated the project to v9.0.0-next.14 / TS v.3.6.4 with ng update and after the CLI linted all files, the issue is not present anymore.

@dvsingh9
Copy link

dvsingh9 commented Nov 3, 2019

ng v9.0.0-rc.0 and ts v3.6.4 not working for me.

@akolybelnikov
Copy link
Author

Closing my issue as it is resolved in the latest version.

@dvsingh9
Copy link

dvsingh9 commented Nov 8, 2019

Closing my issue as it is resolved in the latest version.

issue still persist with .rc version.

Angular CLI: 9.0.0-rc.1
Node: 12.8.0
OS: darwin x64
Angular:
...

Package Version

@angular-devkit/architect 0.900.0-rc.1
@angular-devkit/core 9.0.0-rc.1
@angular-devkit/schematics 9.0.0-rc.1
@schematics/angular 9.0.0-rc.1
@schematics/update 0.900.0-rc.1
rxjs 6.5.3

and I am using ts v3.6.4

@ngfelixl
Copy link
Contributor

I had exactly the same issue with the following versions:

"@angular/core": "~9.0.0-rc.3",
"@angular-devkit/build-angular": "~0.900.0-rc.3",
"@angular/compiler-cli": "~9.0.0-rc.3",
"@angular/language-service": "~9.0.0-rc.3",
"typescript": "^3.6.4"

What fixed it for me was the update to the same angular/cli version

"@angular/cli": "~9.0.0-rc.3"

@sysmat
Copy link

sysmat commented Dec 9, 2019

I try typescript 3.6, 3.7 and still not working. I don't think typescript is buggish, but ivy how orginize imports

@eiswind
Copy link

eiswind commented Dec 13, 2019

I get the same error with rc6, typescript 3.6.4

@duoduoObama
Copy link

I get the same error with 9.0.0-rc.7,typescript 3.6.4...

@eiswind
Copy link

eiswind commented Dec 20, 2019

Updating to

"@angular-devkit/build-angular": "~0.900.0-rc.7"

solved it at my side.

@moez-sadok
Copy link

After the checking of the official AIO package.json, the Angular team stay using ^9.0.0-rc.3 and the "@angular-devkit/build-angular": "~0.900.0-rc.3"

Until today is work as a charm

https://github.com/angular/angular/blob/master/aio/package.json

@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 Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: compiler Issues related to `ngc`, Angular's template compiler freq2: medium type: bug/fix
Projects
None yet
Development

No branches or pull requests