@@ -2,14 +2,14 @@ import * as path from 'path';
2
2
import * as webpack from 'webpack' ;
3
3
import * as fs from 'fs' ;
4
4
import * as semver from 'semver' ;
5
- import * as ts from 'typescript' ;
6
5
import { stripIndent } from 'common-tags' ;
7
6
import { LicenseWebpackPlugin } from 'license-webpack-plugin' ;
8
7
import { PurifyPlugin } from '@angular-devkit/build-optimizer' ;
9
8
import { StaticAssetPlugin } from '../../plugins/static-asset' ;
10
9
import { GlobCopyWebpackPlugin } from '../../plugins/glob-copy-webpack-plugin' ;
11
10
import { WebpackConfigOptions } from '../webpack-config' ;
12
11
import { readTsconfig } from '../../utilities/read-tsconfig' ;
12
+ import { requireProjectModule } from '../../utilities/require-project-module' ;
13
13
14
14
const UglifyJSPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
15
15
@@ -24,6 +24,8 @@ const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
24
24
export function getProdConfig ( wco : WebpackConfigOptions ) {
25
25
const { projectRoot, buildOptions, appConfig } = wco ;
26
26
27
+ const projectTs = requireProjectModule ( projectRoot , 'typescript' ) ;
28
+
27
29
let extraPlugins : any [ ] = [ ] ;
28
30
let entryPoints : { [ key : string ] : string [ ] } = { } ;
29
31
@@ -124,8 +126,8 @@ export function getProdConfig(wco: WebpackConfigOptions) {
124
126
// Read the tsconfig to determine if we should apply ES6 uglify.
125
127
const tsconfigPath = path . resolve ( projectRoot , appConfig . root , appConfig . tsconfig ) ;
126
128
const tsConfig = readTsconfig ( tsconfigPath ) ;
127
- const supportES2015 = tsConfig . options . target !== ts . ScriptTarget . ES3
128
- && tsConfig . options . target !== ts . ScriptTarget . ES5 ;
129
+ const supportES2015 = tsConfig . options . target !== projectTs . ScriptTarget . ES3
130
+ && tsConfig . options . target !== projectTs . ScriptTarget . ES5 ;
129
131
130
132
return {
131
133
entry : entryPoints ,
0 commit comments