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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ReferenceError: __decorate is not defined #304

Open
macjohnny opened this issue Oct 22, 2020 · 2 comments
Open

Uncaught ReferenceError: __decorate is not defined #304

macjohnny opened this issue Oct 22, 2020 · 2 comments

Comments

@macjohnny
Copy link
Contributor

Environment
Provide the content of the package.json file in the project:

@nativescript/[email protected]

Describe the bug
When starting the newly created app, the error Uncaught ReferenceError: __decorate is not defined occurs in the browser and the app crashes.

To Reproduce

ng new -c=@nativescript/schematics dummy-nativescript --shared
cd dummy-nativescript
ng serve

Expected behavior
No error

Additional context
The solution is to remove the following lines from the tsconfig.json:

    "noEmitHelpers": true, 

(Credits: https://stackoverflow.com/a/64088843)

@rob4226
Copy link

rob4226 commented Oct 26, 2020

I just had the same issue but I wasn't sure if the NativeScript mobile part of the shared app needs the "noEmitHelpers": true, so instead I put "noEmitHelpers": false, into the "tsconfig.app.json" file so it would only affect the typescript compiler options of the web browser portion of the project which also fixed this issue.

@steamwings
Copy link

steamwings commented Nov 8, 2020

For my newly created code-sharing Angular project, ng serve first gave me

ERROR in ./src/polyfills.ts
Module not found: Error: Can't resolve 'core-js/es7/reflect' in ...

which I resolved by editing polyfills.ts to have import 'core-js/es/reflect'; instead of import 'core-js/es7/reflect';. (Note: my package.json has "core-js": "^3.6.0",.)

After that change, I now got Uncaught ReferenceError: __decorate is not defined, which was resolved as discussed above. After both changes, the demo app ran as expected.

EDIT:
I opened #306 regarding the polyfills error. The better fix is actually to add the missing .browserslistrc file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants