Skip to content

Remove canary-gate and add experimental warning for alternate bundler #77806

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

Merged
merged 1 commit into from
Apr 8, 2025
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
2 changes: 1 addition & 1 deletion packages/next-rspack/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# next-rspack (EXPERIMENTAL)

> [!WARNING]
> This package is currently experimental and actively developed and supported in Next.js’ `canary` branch. To use this, you must be using a published canary build of Next.js.
> This package is currently experimental. It's not an official Next.js plugin, and is supported by the Rspack team in partnership with Next.js. Help improve Next.js and Rspack by providing feedback at https://github.com/vercel/next.js/discussions/77800

This plugin allows you to use [Rspack](https://rspack.dev) in place of webpack with Next.js.

Expand Down
2 changes: 1 addition & 1 deletion packages/next-rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "15.3.0-canary.41",
"repository": {
"url": "vercel/next.js",
"directory": "packages/next-plugin-rspack"
"directory": "packages/next-rspack"
},
"types": "index.d.ts",
"dependencies": {
Expand Down
16 changes: 7 additions & 9 deletions packages/next/src/shared/lib/get-rspack.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CanaryOnlyError, isStableBuild } from './canary-only'
import { warnOnce } from '../../build/output/log'

export function getRspackCore() {
gateCanary()
warnRspack()
try {
// eslint-disable-next-line import/no-extraneous-dependencies
return require('@rspack/core')
Expand All @@ -17,7 +17,7 @@ export function getRspackCore() {
}

export function getRspackReactRefresh() {
gateCanary()
warnRspack()
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const plugin = require('@rspack/plugin-react-refresh')
Expand All @@ -37,10 +37,8 @@ export function getRspackReactRefresh() {
}
}

function gateCanary() {
if (isStableBuild()) {
throw new CanaryOnlyError(
'Rspack support is only available in Next.js canary.'
)
}
function warnRspack() {
warnOnce(
`\`next-rspack\` is currently experimental. It's not an official Next.js plugin, and is supported by the Rspack team in partnership with Next.js. Help improve Next.js and Rspack by providing feedback at https://github.com/vercel/next.js/discussions/77800`
)
}
Loading