-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@angular/cli): support ES2015 target
- Loading branch information
1 parent
cd404e2
commit dea04b1
Showing
8 changed files
with
164 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as path from 'path'; | ||
import * as ts from 'typescript'; | ||
|
||
export function readTsconfig(tsconfigPath: string) { | ||
const configResult = ts.readConfigFile(tsconfigPath, ts.sys.readFile); | ||
const tsConfig = ts.parseJsonConfigFileContent(configResult.config, ts.sys, | ||
path.dirname(tsconfigPath), undefined, tsconfigPath); | ||
return tsConfig; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { appendToFile, expectFileToMatch } from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
import { expectToFail } from '../../utils/utils'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
|
||
|
||
export default function () { | ||
return Promise.resolve() | ||
// Force import a known ES6 module and build with prod. | ||
// ES6 modules will cause UglifyJS to fail on a ES5 compilation target (default). | ||
.then(() => appendToFile('src/main.ts', ` | ||
import * as es6module from '@angular/core/@angular/core'; | ||
console.log(es6module); | ||
`)) | ||
.then(() => expectToFail(() => ng('build', '--prod'))) | ||
.then(() => updateJsonFile('tsconfig.json', configJson => { | ||
const compilerOptions = configJson['compilerOptions']; | ||
compilerOptions['target'] = 'es2015'; | ||
})) | ||
.then(() => ng('build', '--prod', '--output-hashing=none')) | ||
// Check class constructors are present in the vendor output. | ||
.then(() => expectFileToMatch('dist/vendor.bundle.js', /class \w{constructor\(\){/)); | ||
} |