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

feat(nextjs): add support for typescript Next.js config file #28709

Merged
merged 1 commit into from
Oct 30, 2024
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
1 change: 1 addition & 0 deletions docs/generated/packages/next/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The `@nx/next` plugin will create tasks for any project that has a Next.js confi
- `next.config.js`
- `next.config.cjs`
- `next.config.mjs`
- `next.config.ts`

### View Inferred Tasks

Expand Down
1 change: 1 addition & 0 deletions docs/shared/packages/next/plugin-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The `@nx/next` plugin will create tasks for any project that has a Next.js confi
- `next.config.js`
- `next.config.cjs`
- `next.config.mjs`
- `next.config.ts`

### View Inferred Tasks

Expand Down
4 changes: 2 additions & 2 deletions packages/devkit/src/utils/add-plugin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('addPlugin', () => {
},
};
createNodes = [
'**/next.config.{js,cjs,mjs}',
'**/next.config.{ts,js,cjs,mjs}',
(_, { targetName }) => [
[
'app1/next.config.js',
Expand Down Expand Up @@ -300,7 +300,7 @@ describe('addPlugin', () => {
});

createNodes = [
'**/next.config.{js,cjs,mjs}',
'**/next.config.{ts,js,cjs,mjs}',
() => [
[
'app1/next.config.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ export function findNextConfigPath(
);
}

const candidates = ['next.config.js', 'next.config.cjs', 'next.config.mjs'];
const candidates = [
'next.config.js',
'next.config.cjs',
'next.config.mjs',
'next.config.ts',
];
for (const candidate of candidates) {
if (existsSync(join(dirname, candidate))) return candidate;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/plugins/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface NextPluginOptions {
serveStaticTargetName?: string;
}

const nextConfigBlob = '**/next.config.{js,cjs,mjs}';
const nextConfigBlob = '**/next.config.{ts,js,cjs,mjs}';

function readTargetsCache(
cachePath: string
Expand Down