Skip to content

Commit fb38375

Browse files
hanslclydin
authored andcommitted
fix(@ngtools/webpack): suppress warnings for overwriting files in tsc
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
1 parent ffd156a commit fb38375

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Diff for: packages/@ngtools/webpack/src/angular_compiler_plugin.ts

+1
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ export class AngularCompilerPlugin implements Tapable {
181181

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

185186
// Default plugin sourceMap to compiler options setting.
186187
if (!options.hasOwnProperty('sourceMap')) {

Diff for: tests/e2e/tests/build/allow-js.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { ng } from '../../utils/process';
2+
import { updateTsConfig } from '../../utils/project';
3+
import { appendToFile, writeFile } from '../../utils/fs';
4+
5+
export default async function() {
6+
await writeFile('src/my-js-file.js', 'console.log(1); export const a = 2;');
7+
await appendToFile('src/main.ts', `
8+
import { a } from './my-js-file';
9+
console.log(a);
10+
`);
11+
12+
await updateTsConfig(json => {
13+
json['compilerOptions'].allowJs = true;
14+
});
15+
16+
await ng('build');
17+
await ng('build', '--aot');
18+
}

0 commit comments

Comments
 (0)