Skip to content

Commit

Permalink
fix(node): ensure that bundlers for node is webpack/esbuild (#16702)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndcunningham authored May 2, 2023
1 parent a425f5b commit 8dec11e
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

1 comment on commit 8dec11e

@vercel
Copy link

@vercel vercel bot commented on 8dec11e May 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev
nx-five.vercel.app

Please sign in to comment.