Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled
53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
# Developing Using Your Local Version of Next.js
|
|
|
|
There are two options to develop with your local version of the codebase:
|
|
|
|
## Develop inside the monorepo
|
|
|
|
This will use the version of `next` built inside of the Next.js monorepo. You can also let `pnpm dev` run in a separate terminal. This will let you make changes to Next.js at the same time (note that some changes might require re-running `pnpm next-with-deps` or `pnpm next`).
|
|
|
|
If your app does not have dependencies, you can create a directory inside the monorepo (eg.: `dev-app`) and run `pnpm next ./dev-app` without creating a `package.json` file.
|
|
|
|
If you already have an app and it has dependencies, you can follow these steps:
|
|
|
|
1. Move your app inside of the Next.js monorepo.
|
|
|
|
2. Run with `pnpm next-with-deps ./app-path-in-monorepo`.
|
|
|
|
## Set as a local dependency in `package.json`
|
|
|
|
1. Run `pnpm dev` in the background in the Next.js monorepo.
|
|
|
|
2. In your app's root directory, run:
|
|
|
|
```sh
|
|
pnpm add ./path/to/next.js/{packages/next,node_modules/{react,react-dom}}
|
|
```
|
|
|
|
to re-install all of the dependencies and point `next`, `react` and `react-dom` to the monorepo versions.
|
|
|
|
Note that Next.js will be copied from the locally compiled version as opposed to being downloaded from the NPM registry.
|
|
|
|
3. Run your application as you normally would.
|
|
|
|
### Troubleshooting
|
|
|
|
- If you see the below error while running `pnpm dev` with `next`:
|
|
|
|
```
|
|
Failed to load SWC binary, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
|
|
```
|
|
|
|
Try to add the below section to your `package.json`, then run again.
|
|
|
|
```json
|
|
{
|
|
"optionalDependencies": {
|
|
"@next/swc-linux-x64-gnu": "canary",
|
|
"@next/swc-win32-x64-msvc": "canary",
|
|
"@next/swc-darwin-x64": "canary",
|
|
"@next/swc-darwin-arm64": "canary"
|
|
}
|
|
}
|
|
```
|