Skip to content

Commit

Permalink
fix(@ngtools/webpack): suppress warnings for overwriting files in tsc
Browse files Browse the repository at this point in the history
Since we're using a virtual filesystem, overwriting files by tsc does
not affect actual files on the filesystem. This allows us to support
allowJs without changing any configuration quirks.

Fixes angular/angular#21080
Might help with #8371
Fixes #8885
  • Loading branch information
hansl authored and clydin committed Feb 7, 2018
1 parent db24636 commit f560391
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export class AngularCompilerPlugin implements Tapable {

// Overwrite outDir so we can find generated files next to their .ts origin in compilerHost.
this._compilerOptions.outDir = '';
this._compilerOptions.suppressOutputPathCheck = true;

// Default plugin sourceMap to compiler options setting.
if (!options.hasOwnProperty('sourceMap')) {
Expand Down
18 changes: 18 additions & 0 deletions tests/e2e/tests/build/allow-js.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ng } from '../../utils/process';
import { updateTsConfig } from '../../utils/project';
import { appendToFile, writeFile } from '../../utils/fs';

export default async function() {
await writeFile('src/my-js-file.js', 'console.log(1); export const a = 2;');
await appendToFile('src/main.ts', `
import { a } from './my-js-file';
console.log(a);
`);

await updateTsConfig(json => {
json['compilerOptions'].allowJs = true;
});

await ng('build');
await ng('build', '--aot');
}

0 comments on commit f560391

Please sign in to comment.