Skip to content

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

@Jonathan002

Description

@Jonathan002

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions