-
Notifications
You must be signed in to change notification settings - Fork 27.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gate alternate bundler behind canary only
This restricts rspack to only be used with canary builds, and updates the plugin’s readme to note this, along with its experimental state. Test Plan: Made a custom build with a `__NEXT_VERSION` of `15.2.0` and verified builds failed with the canary-only message.
- Loading branch information
1 parent
20f72b9
commit 3b8f994
Showing
5 changed files
with
50 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export function isStableBuild() { | ||
return ( | ||
!process.env.__NEXT_VERSION?.includes('canary') && | ||
!process.env.__NEXT_TEST_MODE && | ||
!process.env.NEXT_PRIVATE_LOCAL_DEV | ||
) | ||
} | ||
|
||
export class CanaryOnlyError extends Error { | ||
constructor(arg: { feature: string } | string) { | ||
if (typeof arg === 'object' && 'feature' in arg) { | ||
super( | ||
`The experimental feature "${arg.feature}" can only be enabled when using the latest canary version of Next.js.` | ||
) | ||
} else { | ||
super(arg) | ||
} | ||
|
||
// This error is meant to interrupt the server start/build process | ||
// but the stack trace isn't meaningful, as it points to internal code. | ||
this.stack = undefined | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters