diff --git a/packages/js/src/generators/library/library.ts b/packages/js/src/generators/library/library.ts index 747e809ea350c..5d790a88ac8ed 100644 --- a/packages/js/src/generators/library/library.ts +++ b/packages/js/src/generators/library/library.ts @@ -856,7 +856,9 @@ async function normalizeOptions( } if (options.bundler === 'none') { - options.bundler = 'tsc'; + throw new Error( + `Publishable libraries can't be generated with "--bundler=none". Please select a valid bundler.` + ); } } diff --git a/packages/nest/src/generators/library/lib/normalize-options.ts b/packages/nest/src/generators/library/lib/normalize-options.ts index f3b84309e0ef7..8b1f1673c3902 100644 --- a/packages/nest/src/generators/library/lib/normalize-options.ts +++ b/packages/nest/src/generators/library/lib/normalize-options.ts @@ -64,7 +64,7 @@ export function toJsLibraryGeneratorOptions( ): JsLibraryGeneratorSchema { return { name: options.name, - bundler: options?.buildable ? 'tsc' : 'none', + bundler: options.buildable || options.publishable ? 'tsc' : 'none', directory: options.directory, importPath: options.importPath, linter: options.linter, diff --git a/packages/node/src/generators/library/library.ts b/packages/node/src/generators/library/library.ts index d2dc70409a2d6..4eec1209d3c8c 100644 --- a/packages/node/src/generators/library/library.ts +++ b/packages/node/src/generators/library/library.ts @@ -59,7 +59,7 @@ export async function libraryGeneratorInternal(tree: Tree, schema: Schema) { const libraryInstall = await jsLibraryGenerator(tree, { ...options, - bundler: schema.buildable ? 'tsc' : 'none', + bundler: schema.buildable || schema.publishable ? 'tsc' : 'none', includeBabelRc: schema.babelJest, importPath: options.importPath, testEnvironment: 'node',