diff --git a/src/compilerSetup.ts b/src/compilerSetup.ts index a61197eb8..57af24295 100644 --- a/src/compilerSetup.ts +++ b/src/compilerSetup.ts @@ -51,11 +51,11 @@ export function getCompilerOptions( }); // if `module` is not specified and not using ES6 target, default to CJS module output - if ((!compilerOptions.module) && compilerOptions.target !== 2 /* ES6 */) { - compilerOptions.module = 1; /* CommonJS */ - } else if (compilerCompatible && semver.lt(compiler.version, '1.7.3-0') && compilerOptions.target === 2 /* ES6 */) { + if ((!compilerOptions.module) && compilerOptions.target !== compiler.ScriptTarget.ES6) { + compilerOptions.module = compiler.ModuleKind.CommonJS; + } else if (compilerCompatible && semver.lt(compiler.version, '1.7.3-0') && compilerOptions.target === compiler.ScriptTarget.ES6) { // special handling for TS 1.6 and target: es6 - compilerOptions.module = 0 /* None */; + compilerOptions.module = compiler.ModuleKind.None; } return compilerOptions; diff --git a/src/servicesHost.ts b/src/servicesHost.ts index 60e00a4f2..8734d32ac 100644 --- a/src/servicesHost.ts +++ b/src/servicesHost.ts @@ -19,8 +19,8 @@ function makeServicesHost( const { compiler, compilerOptions, files } = instance; const newLine = - compilerOptions.newLine === 0 /* CarriageReturnLineFeed */ ? constants.CarriageReturnLineFeed : - compilerOptions.newLine === 1 /* LineFeed */ ? constants.LineFeed : + compilerOptions.newLine === compiler.NewLineKind.CarriageReturnLineFeed ? constants.CarriageReturnLineFeed : + compilerOptions.newLine === compiler.NewLineKind.LineFeed ? constants.LineFeed : constants.EOL; // make a (sync) resolver that follows webpack's rules