question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use aot with a let var in custom scripts

See original GitHub issue

Versions

@angular/cdk: 5.0.0-rc0
@angular/cli: 1.5.2
@angular/material: 5.0.0-rc0
@angular/platform-server: 4.4.6
@angular/tsc-wrapped: 4.4.6
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.35
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.2
@schematics/angular: 0.1.2
typescript: 2.4.2
webpack: 3.8.1

Repro steps

  • Create New Angular CLI Project
  • Create a script file in src and add it to angular.cli
  • Create a let var in custom script -
    /src/custom-script.js - let object = {}
  • Try to compile the project with --aot and --prod flag. npm run build --aot --prod

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

You will get the error:

(node:22021) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

and no dist folder will be created.

Desired behavior

Successful aot build compilation and creation of a dist folder for the project.

Mention any other details that might be useful (optional)

I’ve created a repository with the custom script problem setup in .angular-cli.json.

Link: https://github.com/Jonathan002/angular-cli-broken-aot-demo

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
filipesilvacommented, Dec 7, 2017

@tomastrajan thanks for taking this on. I also pinged the library owner there about this change.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AOT metadata errors - Angular
AOT metadata errorslink · Expression form not supportedlink · Reference to a local (non-exported) symbollink · Only initialized variables and constantslink.
Read more >
Method to pass environment variables during build vs file ...
We have a single environment.ts file for all builds and use a custom script to generate the correct values via the env variables....
Read more >
Scripting restrictions - Unity - Manual
Unity provides a common scripting API and experience across all platforms it supports. However, some platforms have inherent restrictions.
Read more >
Angular prod build error in Cannot assign to a reference or ...
Let's open this file and try to search the text Cannot assign to a reference or variable! . We will find the _AstToIrVisitor...
Read more >
Custom AWS Lambda runtimes
It can be a shell script, a script in a language that's included in Amazon Linux, ... To use a custom runtime, set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found