Skip to content

Commit c0c9e85

Browse files
committed
fix(vite): remove environments generation
closed #14256
1 parent f8854d7 commit c0c9e85

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

packages/react/src/generators/application/application.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,13 @@ export async function applicationGenerator(host: Tree, schema: Schema) {
103103
const { viteConfigurationGenerator } = await import('@nrwl/vite');
104104
// We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development.
105105
// See: https://vitejs.dev/guide/env-and-mode.html
106-
host.delete(joinPathFragments(options.appProjectRoot, 'src/environments'));
106+
if (
107+
host.exists(joinPathFragments(options.appProjectRoot, 'src/environments'))
108+
) {
109+
host.delete(
110+
joinPathFragments(options.appProjectRoot, 'src/environments')
111+
);
112+
}
107113

108114
const viteTask = await viteConfigurationGenerator(host, {
109115
uiFramework: 'react',

packages/web/src/generators/application/application.spec.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
import { installedCypressVersion } from '@nrwl/cypress/src/utils/cypress-version';
2-
import {
3-
NxJsonConfiguration,
4-
readProjectConfiguration,
5-
Tree,
6-
} from '@nrwl/devkit';
2+
import { readProjectConfiguration, Tree } from '@nrwl/devkit';
73
import { getProjects, readJson } from '@nrwl/devkit';
84
import { createTreeWithEmptyV1Workspace } from '@nrwl/devkit/testing';
95

packages/web/src/generators/application/application.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,13 @@ export async function applicationGenerator(host: Tree, schema: Schema) {
199199
const { viteConfigurationGenerator } = require('@nrwl/vite');
200200
// We recommend users use `import.meta.env.MODE` and other variables in their code to differentiate between production and development.
201201
// See: https://vitejs.dev/guide/env-and-mode.html
202-
host.delete(joinPathFragments(options.appProjectRoot, 'src/environments'));
202+
if (
203+
host.exists(joinPathFragments(options.appProjectRoot, 'src/environments'))
204+
) {
205+
host.delete(
206+
joinPathFragments(options.appProjectRoot, 'src/environments')
207+
);
208+
}
203209

204210
const viteTask = await viteConfigurationGenerator(host, {
205211
uiFramework: 'none',

packages/web/src/generators/application/files/app-vite/src/environments/environment.prod.ts__tmpl__

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/web/src/generators/application/files/app-vite/src/environments/environment.ts__tmpl__

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)