Skip to content

Commit

Permalink
fix(@schematics/angular): set optimization and sourceMap in unive…
Browse files Browse the repository at this point in the history
…rsal production config

- When using Universal sourceMaps should not be enabled or at least `styles` sourceMaps should be disabled as these will otherwise be inlined and will be set as apart of the server side rendered page.

- While there is no benefit to optimize the scripts at server level, styles should always be minified so that the server side rendered page is smaller.

Fixes #12541 and Fixes #12940
  • Loading branch information
alan-agius4 authored and mgechev committed Dec 14, 2018
1 parent e447489 commit 17ba2bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/schematics/angular/universal/index.ts
Expand Up @@ -67,6 +67,11 @@ function updateConfigFile(options: UniversalOptions, tsConfigDirectory: Path): R
configurations: {
production: {
fileReplacements: getFileReplacements(projectTargets),
sourceMap: false,
optimization: {
scripts: false,
styles: true,
},
},
},
};
Expand Down
5 changes: 5 additions & 0 deletions packages/schematics/angular/utility/workspace-models.ts
Expand Up @@ -74,6 +74,11 @@ export interface ServerBuilderOptions {
tsConfig: string;
main: string;
fileReplacements?: FileReplacements[];
optimization?: {
scripts?: boolean;
styles?: boolean;
};
sourceMap?: boolean;
}

export interface AppShellBuilderOptions {
Expand Down

0 comments on commit 17ba2bc

Please sign in to comment.