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

Rename alternate bundler package name #77793

Merged
merged 1 commit into from
Apr 3, 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 examples/with-rspack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
> [!WARNING]
> This example uses a 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 example demonstrates using Rspack in place of webpack in Next.js using `@next/plugin-rspack`.
This example demonstrates using Rspack in place of webpack in Next.js using `next-rspack`.

## Deploy your own

Expand Down
2 changes: 1 addition & 1 deletion examples/with-rspack/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withRspack = require("@next/plugin-rspack");
const withRspack = require("next-rspack");

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"react-dom": "^18.3.1"
},
"devDependencies": {
"@next/plugin-rspack": "canary",
"next-rspack": "canary",
"@types/node": "^22.10.1",
"@types/react": "^18.3.12",
"typescript": "^5.7.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @next/plugin-rspack (EXPERIMENTAL)
# 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.
Expand All @@ -8,21 +8,21 @@ This plugin allows you to use [Rspack](https://rspack.dev) in place of webpack w
## Installation

```
npm install @next/plugin-rspack
npm install next-rspack
```

or

```
yarn add @next/plugin-rspack
yarn add next-rspack
```

## Usage

Create or update a `next.config.js`/`next.config.ts` and wrap your existing configuration:

```js
const withRspack = require('@next/plugin-rspack')
const withRspack = require('next-rspack')

/** @type {import('next').NextConfig} */
const nextConfig = {
Expand All @@ -34,11 +34,11 @@ module.exports = withRspack(nextConfig)

## Usage with next-compose-plugins

Alternatively, you can use `next-compose-plugins` to quickly integrate `@next/plugin-rspack` with other Next.js plugins:
Alternatively, you can use `next-compose-plugins` to quickly integrate `next-rspack` with other Next.js plugins:

```js
const withPlugins = require('next-compose-plugins')
const withRspack = require('@next/plugin-rspack')
const withRspack = require('next-rspack')

module.exports = withPlugins([
[withRspack],
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@next/plugin-rspack",
"name": "next-rspack",
"version": "15.3.0-canary.33",
"repository": {
"url": "vercel/next.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/next/errors.json
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@
"644": "@rspack/core is not available. Please make sure the appropriate Next.js plugin is installed.",
"645": "@rspack/plugin-react-refresh is not available. Please make sure the appropriate Next.js plugin is installed.",
"646": "No span found for compilation",
"647": "@rspack/core is not available. Please make sure `@next/plugin-rspack` is correctly installed.",
"648": "@rspack/plugin-react-refresh is not available. Please make sure `@next/plugin-rspack` is correctly installed.",
"647": "@rspack/core is not available. Please make sure `next-rspack` is correctly installed.",
"648": "@rspack/plugin-react-refresh is not available. Please make sure `next-rspack` is correctly installed.",
"649": "Cache handlers not initialized",
"650": "experimental.nodeMiddleware",
"651": "Unexpected module type %s",
Expand Down
2 changes: 1 addition & 1 deletion packages/next/src/cli/next-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async function printInfo() {

if (process.env.NEXT_RSPACK) {
relevantPackages += `
@next/plugin-rspack: ${getPackageVersion('@next/plugin-rspack')}`
next-rspack: ${getPackageVersion('next-rspack')}`
}

console.log(`
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/shared/lib/get-rspack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export function getRspackCore() {
} catch (e) {
if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
throw new Error(
'@rspack/core is not available. Please make sure `@next/plugin-rspack` is correctly installed.'
'@rspack/core is not available. Please make sure `next-rspack` is correctly installed.'
)
}

Expand All @@ -24,7 +24,7 @@ export function getRspackReactRefresh() {
} catch (e) {
if (e instanceof Error && 'code' in e && e.code === 'MODULE_NOT_FOUND') {
throw new Error(
'@rspack/plugin-react-refresh is not available. Please make sure `@next/plugin-rspack` is correctly installed.'
'@rspack/plugin-react-refresh is not available. Please make sure `next-rspack` is correctly installed.'
)
}

Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions test/lib/create-next-install.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,7 @@ async function createNextInstall({
}

if (useRspack) {
combinedDependencies['@next/plugin-rspack'] = pkgPaths.get(
'@next/plugin-rspack'
)
combinedDependencies['next-rspack'] = pkgPaths.get('next-rspack')
}

const scripts = {
Expand Down Expand Up @@ -192,7 +190,7 @@ async function createNextInstall({
}

if (useRspack) {
// This is what the @next/plugin-rspack plugin does.
// This is what the next-rspack plugin does.
// TODO: Load the plugin properly during test
process.env.NEXT_RSPACK = 'true'
process.env.RSPACK_CONFIG_VALIDATE = 'loose-silent'
Expand Down
Loading