diff --git a/packages/next/src/generators/application/lib/create-application-files.ts b/packages/next/src/generators/application/lib/create-application-files.ts index d70728da10ce5..ae9fe71e7e141 100644 --- a/packages/next/src/generators/application/lib/create-application-files.ts +++ b/packages/next/src/generators/application/lib/create-application-files.ts @@ -63,6 +63,10 @@ export function createApplicationFiles(host: Tree, options: NormalizedSchema) { let { extends: _, ...updatedJson } = json; + // Don't generate the `paths` object or else workspace libs will not work later. + // It'll be generated as needed when a lib is first added. + delete json.compilerOptions.paths; + updatedJson = { ...updateJson, compilerOptions: { diff --git a/packages/next/src/generators/library/library.ts b/packages/next/src/generators/library/library.ts index c548ee0d9f705..b1d6cf2c32b74 100644 --- a/packages/next/src/generators/library/library.ts +++ b/packages/next/src/generators/library/library.ts @@ -54,7 +54,20 @@ export async function libraryGenerator(host: Tree, rawOptions: Schema) { 'src', `server.${options.js ? 'js' : 'ts'}` ), - `// Use this file to export React server components\n` + `// Use this file to export React server components + export * from './lib/hello-server';` + ); + host.write( + joinPathFragments( + options.projectRoot, + 'src/lib', + `hello-server.${options.js ? 'js' : 'tsx'}` + ), + `// React server components are async so you make database or API calls. + export async function HelloServer() { + return

Hello Server

+ } + ` ); addTsConfigPath(host, `${options.importPath}/server`, [serverEntryPath]); diff --git a/packages/react/src/generators/library/library.ts b/packages/react/src/generators/library/library.ts index ab36bb8700240..8da30b7efbdf3 100644 --- a/packages/react/src/generators/library/library.ts +++ b/packages/react/src/generators/library/library.ts @@ -43,7 +43,7 @@ export async function libraryGenerator(host: Tree, schema: Schema) { ...options, e2eTestRunner: 'none', skipFormat: true, - skipBabelConfig: options.bundler === 'vite', + skipBabelConfig: options.bundler === 'vite' || options.compiler === 'swc', skipHelperLibs: options.bundler === 'vite', }); tasks.push(initTask);