Skip to content

Commit

Permalink
fix(node): ensure that bundlers for node is webpack/esbuild (nrwl#16702)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham authored and AgentEnder committed May 3, 2023
1 parent a425f5b commit b7ecd81
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/generated/packages/workspace/generators/preset.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"bundler": {
"description": "The bundler to use for building the application.",
"type": "string",
"enum": ["webpack", "vite", "rspack"],
"enum": ["webpack", "vite", "rspack", "esbuild"],
"default": "vite"
},
"docker": {
Expand Down
2 changes: 0 additions & 2 deletions packages/node/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,9 @@ function addProjectDependencies(
const frameworkDependencies = {
express: {
express: expressVersion,
'@types/express': expressTypingsVersion,
},
koa: {
koa: koaVersion,
'@types/koa': koaTypingsVersion,
},
fastify: {
fastify: fastifyVersion,
Expand Down
8 changes: 7 additions & 1 deletion packages/workspace/src/generators/new/generate-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,13 @@ function getPresetDependencies({
};

case Preset.NodeStandalone:
return { dependencies: {}, dev: { '@nx/node': nxVersion } };
return {
dependencies: {},
dev: {
'@nx/node': nxVersion,
'@nx/webpack': bundler === 'webpack' ? nxVersion : undefined,
},
};

default: {
return {
Expand Down
3 changes: 2 additions & 1 deletion packages/workspace/src/generators/preset/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ async function createPreset(tree: Tree, options: Schema) {
} else if (options.preset === Preset.NodeStandalone) {
const { applicationGenerator: nodeApplicationGenerator } = require('@nx' +
'/node');
const bundler = options.bundler === 'webpack' ? 'webpack' : 'esbuild';
return nodeApplicationGenerator(tree, {
bundler: options.bundler,
bundler,
name: options.name,
linter: options.linter,
standaloneConfig: options.standaloneConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/preset/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface Schema {
standaloneConfig?: boolean;
framework?: string;
packageManager?: PackageManager;
bundler?: 'vite' | 'webpack' | 'rspack';
bundler?: 'vite' | 'webpack' | 'rspack' | 'esbuild';
docker?: boolean;
nextAppDir?: boolean;
routing?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/preset/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"bundler": {
"description": "The bundler to use for building the application.",
"type": "string",
"enum": ["webpack", "vite", "rspack"],
"enum": ["webpack", "vite", "rspack", "esbuild"],
"default": "vite"
},
"docker": {
Expand Down

0 comments on commit b7ecd81

Please sign in to comment.