rsnext/examples/with-turbopack-loaders
Will Binns-Smith 7230258898
Add loader-runner to compiled packages (#45962)
This adds `loader-runner` to the compiled packages distributed with
Next.js

This is a dependency of Turbopack's webpack loader support. Currently,
users have to manually install `loader-runner` in their application to
use webpack loaders with Turbopack. This will allow Turbopack to require
loader-runner from within the installed version of Next.js instead.

Test Plan: `require('./packages/next/dist/compiled/loader-runner/')`

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2023-02-17 22:24:40 -08:00
..
pages Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00
.gitignore Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00
next.config.js Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00
package.json Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00
README.md Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00
vercel.svg Add loader-runner to compiled packages (#45962) 2023-02-17 22:24:40 -08:00

Turbopack + Loaders

Turbopack supports a subset of webpack's loader API, allowing you to use some webpack loaders to transform code in Turbopack. This example shows you how to configure Next.js to use webpack loaders when running with next --turbo.

Install the dependencies and start the development server.

npm install
npm run dev

or

yarn
yarn dev

or

pnpm install
pnpm dev

Deploy your own

Deploy the example using Vercel or preview live with StackBlitz

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm to bootstrap the example:

npx create-next-app --example with-turbopack-loaders with-turbopack-loaders-app
yarn create next-app --example with-turbopack-loaders with-turbopack-loaders-app
pnpm create next-app --example with-turbopack-loaders with-turbopack-loaders-app

Deploy it to the cloud with Vercel (Documentation).