fix(nextjs): support canary versions of next (#22672)
<!-- 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` --> ## Current Behavior When using a `canary` version of `next` in an nx monorepo where the next.js application depends on a lib that's also in the monorepo, running `nx build` results in `Module parse failed: Unexpected token` errors start occurring. The use of a `canary` version essentially reintroduces https://github.com/nrwl/nx/issues/16658 because of how `semver` [handles pre-release tags](https://github.com/npm/node-semver/tree/main?tab=readme-ov-file#prerelease-tags). As mentioned in the docs, we can suppress this behavior by passing the `includePrerelease` option, which is what this PR does. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> `nx build` successfully builds my Next.js application ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> https://github.com/nrwl/nx/issues/16658 https://github.com/nrwl/nx/issues/16516 https://github.com/nrwl/nx/issues/19635
This commit is contained in:
parent
b2855fd6e1
commit
a8ae302ae4
@ -421,7 +421,7 @@ export function getAliasForProject(
|
||||
export function forNextVersion(range: string, fn: () => void) {
|
||||
const semver = require('semver');
|
||||
const nextJsVersion = require('next/package.json').version;
|
||||
if (semver.satisfies(nextJsVersion, range)) {
|
||||
if (semver.satisfies(nextJsVersion, range, { includePrerelease: true })) {
|
||||
fn();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user