Skip to content

TypeScript files added to scripts in .angular-cli.json aren't transpiled to target ES version. #6393

@pietmichal

Description

@pietmichal

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.4 (e)
node: 6.10.0
os: win32 x64
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.0.4
@angular/compiler-cli: 4.1.3

Repro steps.

  1. Create example.ts file in src directory.
// example.ts
import 'rxjs/add/operator/map';
  1. Add example.ts to scripts array in .angular-cli.json.
// ...
"scripts": [ "example.ts" ],
// ...
  1. Run ng serve command.
  2. Check browser's console.

The log given by the failure.

Uncaught SyntaxError: Unexpected token import
    at eval (<anonymous>)
    at webpackJsonp.116.module.exports (addScript.js:9)
    at Object.107 (example.ts?91e1:1)
    at __webpack_require__ (bootstrap 2885b1c…:52)
    at Object.247 (addScript.js:10)
    at __webpack_require__ (bootstrap 2885b1c…:52)
    at webpackJsonpCallback (bootstrap 2885b1c…:23)
    at scripts.bundle.js:1

Desired functionality.

TypeScript files added to scripts in .angular-cli.json are transpiled to target ES version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions