fix(angular): setup-ssr environments file replacements should be removed (#13244)

This commit is contained in:
Colum Ferry 2022-11-18 11:37:28 +00:00 committed by GitHub
parent e041223020
commit b88dc35aa5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 47 deletions

View File

@ -9,12 +9,6 @@ Object {
"sourceMap": true,
},
"production": Object {
"fileReplacements": Array [
Object {
"replace": "apps/app1/src/environments/environment.ts",
"with": "apps/app1/src/environments/environment.prod.ts",
},
],
"outputHashing": "media",
},
},

View File

@ -7,13 +7,5 @@
*/
import '@angular/platform-server/init';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { <%= rootModuleClassName %> } from './app/<%= rootModuleFileName.slice(0, -3) %>';
export { renderModule } from '@angular/platform-server';

View File

@ -1,12 +1,6 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
function bootstrap() {
platformBrowserDynamic()

View File

@ -21,18 +21,6 @@ export function updateProjectConfig(tree: Tree, schema: Schema) {
configurations: {
production: {
outputHashing: 'media',
fileReplacements: [
{
replace: joinPathFragments(
projectConfig.sourceRoot,
'environments/environment.ts'
),
with: joinPathFragments(
projectConfig.sourceRoot,
'environments/environment.prod.ts'
),
},
],
},
development: {
optimization: false,

View File

@ -34,27 +34,13 @@ describe('setupSSR', () => {
*/
import '@angular/platform-server/init';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
export { AppServerModule } from './app/app.server.module';
export { renderModule } from '@angular/platform-server';"
`);
expect(tree.read('apps/app1/src/main.ts', 'utf-8')).toMatchInlineSnapshot(`
"import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
"import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
function bootstrap() {
platformBrowserDynamic()