Skip to content

Commit

Permalink
fix(angular): setup-ssr environments file replacements should be remo…
Browse files Browse the repository at this point in the history
…ved (#13244)

(cherry picked from commit b88dc35)
  • Loading branch information
Coly010 authored and FrozenPandaz committed Nov 18, 2022
1 parent 4c2e5aa commit 1b9c7df
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
Expand Down
8 changes: 0 additions & 8 deletions packages/angular/src/generators/setup-ssr/files/src/__main__
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 1 addition & 15 deletions packages/angular/src/generators/setup-ssr/setup-ssr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 1b9c7df

Please sign in to comment.