Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node): ensure that bundlers for node is webpack/esbuild #16702

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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