feat(nextjs): add support for typescript Next.js config file (#28709)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #28572
This commit is contained in:
parent
63b745e8c3
commit
51bed0e456
@ -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.js`
|
||||||
- `next.config.cjs`
|
- `next.config.cjs`
|
||||||
- `next.config.mjs`
|
- `next.config.mjs`
|
||||||
|
- `next.config.ts`
|
||||||
|
|
||||||
### View Inferred Tasks
|
### View Inferred Tasks
|
||||||
|
|
||||||
|
|||||||
@ -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.js`
|
||||||
- `next.config.cjs`
|
- `next.config.cjs`
|
||||||
- `next.config.mjs`
|
- `next.config.mjs`
|
||||||
|
- `next.config.ts`
|
||||||
|
|
||||||
### View Inferred Tasks
|
### View Inferred Tasks
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ describe('addPlugin', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/next.config.{js,cjs,mjs}',
|
'**/next.config.{ts,js,cjs,mjs}',
|
||||||
(_, { targetName }) => [
|
(_, { targetName }) => [
|
||||||
[
|
[
|
||||||
'app1/next.config.js',
|
'app1/next.config.js',
|
||||||
@ -300,7 +300,7 @@ describe('addPlugin', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
createNodes = [
|
createNodes = [
|
||||||
'**/next.config.{js,cjs,mjs}',
|
'**/next.config.{ts,js,cjs,mjs}',
|
||||||
() => [
|
() => [
|
||||||
[
|
[
|
||||||
'app1/next.config.js',
|
'app1/next.config.js',
|
||||||
|
|||||||
@ -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) {
|
for (const candidate of candidates) {
|
||||||
if (existsSync(join(dirname, candidate))) return candidate;
|
if (existsSync(join(dirname, candidate))) return candidate;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ export interface NextPluginOptions {
|
|||||||
serveStaticTargetName?: string;
|
serveStaticTargetName?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextConfigBlob = '**/next.config.{js,cjs,mjs}';
|
const nextConfigBlob = '**/next.config.{ts,js,cjs,mjs}';
|
||||||
|
|
||||||
function readTargetsCache(
|
function readTargetsCache(
|
||||||
cachePath: string
|
cachePath: string
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user