diff --git a/packages/@ngtools/webpack/src/compiler_host.ts b/packages/@ngtools/webpack/src/compiler_host.ts index d7af11ada7c6..df8cd1d221b9 100644 --- a/packages/@ngtools/webpack/src/compiler_host.ts +++ b/packages/@ngtools/webpack/src/compiler_host.ts @@ -187,8 +187,10 @@ export class WebpackCompilerHost implements ts.CompilerHost { } invalidate(fileName: string): void { - this._files[fileName] = null; - this._changedFiles[fileName] = true; + if (fileName in this._files) { + this._files[fileName] = null; + this._changedFiles[fileName] = true; + } } fileExists(fileName: string): boolean { diff --git a/packages/angular-cli/lib/config/schema.d.ts b/packages/angular-cli/lib/config/schema.d.ts new file mode 100644 index 000000000000..c34275a2522a --- /dev/null +++ b/packages/angular-cli/lib/config/schema.d.ts @@ -0,0 +1,133 @@ +export interface CliConfig { + /** + * The global configuration of the project. + */ + project?: { + version?: string; + name?: string; + }; + /** + * Properties of the different applications in this project. + */ + apps?: { + root?: string; + outDir?: string; + assets?: (string | string[]); + deployUrl?: string; + index?: string; + main?: string; + polyfills?: string; + test?: string; + tsconfig?: string; + prefix?: string; + mobile?: boolean; + /** + * Global styles to be included in the build. + */ + styles?: (string | { + input?: string; + [name: string]: any; + })[]; + /** + * Options to pass to style preprocessors + */ + stylePreprocessorOptions?: { + /** + * Paths to include. Paths will be resolved to project root. + */ + includePaths?: string[]; + }; + /** + * Global scripts to be included in the build. + */ + scripts?: (string | { + input: string; + [name: string]: any; + })[]; + /** + * Name and corresponding file for environment config. + */ + environments?: { + [name: string]: any; + }; + }[]; + /** + * Configuration reserved for installed third party addons. + */ + addons?: { + [name: string]: any; + }[]; + /** + * Configuration reserved for installed third party packages. + */ + packages?: { + [name: string]: any; + }[]; + e2e?: { + protractor?: { + config?: string; + }; + }; + /** + * Properties to be passed to TSLint. + */ + lint?: { + files: string; + project: string; + tslintConfig?: string; + }[]; + test?: { + karma?: { + config?: string; + }; + }; + defaults?: { + styleExt?: string; + prefixInterfaces?: boolean; + poll?: number; + viewEncapsulation?: string; + changeDetection?: string; + inline?: { + style?: boolean; + template?: boolean; + }; + spec?: { + class?: boolean; + component?: boolean; + directive?: boolean; + module?: boolean; + pipe?: boolean; + service?: boolean; + }; + /** + * Properties to be passed to the serve command + */ + serve?: { + /** + * The port the application will be served on + */ + port?: number; + /** + * The host the application will be served on + */ + host?: string; + }; + }; + /** + * Allow people to disable console warnings. + */ + warnings?: { + /** + * Show a warning when the node version is incompatible. + */ + nodeDeprecation?: boolean; + /** + * Show a warning when the user installed angular-cli. + */ + packageDeprecation?: boolean; + /** + * Show a warning when the global version is newer than the local one. + */ + versionMismatch?: boolean; + }; +} diff --git a/tests/e2e/tests/build/rebuild-css-change.ts b/tests/e2e/tests/build/rebuild-css-change.ts new file mode 100644 index 000000000000..8e8a9ce1fdfd --- /dev/null +++ b/tests/e2e/tests/build/rebuild-css-change.ts @@ -0,0 +1,29 @@ +import { + killAllProcesses, + exec, + waitForAnyProcessOutputToMatch, + silentExecAndWaitForOutputToMatch +} from '../../utils/process'; +import {appendToFile} from '../../utils/fs'; + +const webpackGoodRegEx = /webpack: bundle is now VALID|webpack: Compiled successfully./; +const webpackBadRegEx = /webpack: bundle is now INVALID|webpack: Compiling.../; + +export default function() { + if (process.platform.startsWith('win')) { + return Promise.resolve(); + } + + return silentExecAndWaitForOutputToMatch('ng', ['serve'], webpackGoodRegEx) + // Should trigger a rebuild. + .then(() => exec('touch', 'src/main.ts')) + .then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 1000)) + .then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 5000)) + .then(() => appendToFile('src/app/app.component.css', ':host { color: blue; }')) + .then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 1000)) + .then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 5000)) + .then(() => killAllProcesses(), (err: any) => { + killAllProcesses(); + throw err; + }); +}