diff --git a/packages/react/src/generators/library/library.spec.ts b/packages/react/src/generators/library/library.spec.ts
index 469815a192..4a537d98d5 100644
--- a/packages/react/src/generators/library/library.spec.ts
+++ b/packages/react/src/generators/library/library.spec.ts
@@ -533,6 +533,23 @@ describe('lib', () => {
});
});
+ describe('--routing', () => {
+ it('should be able to generate a library with routing', async () => {
+ await libraryGenerator(tree, {
+ ...defaultSchema,
+ routing: true,
+ });
+
+ const content = tree.read('my-lib/src/lib/my-lib.tsx', 'utf-8');
+ expect(content).toContain('react-router-dom');
+
+ expect(content).toMatch(/my-lib root<\/Link>/);
+ expect(content).toMatch(
+ /This is the my-lib root route.<\/div>} \/>/
+ );
+ });
+ });
+
describe('--buildable', () => {
it('should default to rollup bundler', async () => {
await libraryGenerator(tree, {
diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts
index fd26ad9733..f0168729b9 100644
--- a/packages/react/src/generators/library/library.ts
+++ b/packages/react/src/generators/library/library.ts
@@ -248,6 +248,7 @@ export async function libraryGeneratorInternal(host: Tree, schema: Schema) {
export: true,
routing: options.routing,
js: options.js,
+ name: options.name,
inSourceTests: options.inSourceTests,
skipFormat: true,
globalCss: options.globalCss,