Unverified Commit 750eae08 authored by devin-ai-integration[bot]'s avatar devin-ai-integration[bot] Committed by GitHub

Docs: Improve Turbopack webpack loader documentation (#79523)

# Improve Turbopack webpack loader documentation

## Description

This PR improves the Turbopack webpack loader documentation by:

1. Clarifying that the list of supported loaders is not exhaustive
2. Adding a more detailed example showing how to pass options to loaders
using the object format
3. Adding graphql-tag/loader to the list of supported loaders based on
customer feedback

This addresses customer confusion about how to pass options to loaders
and clarifies that many loaders beyond those explicitly listed will
work.

Link to Devin run:
https://app.devin.ai/sessions/33095930f1f34a6daf81c2ce7eca3be0
Requested by: lee@vercel.com

---------
Co-authored-by: 's avatarDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: 's avatarlee@vercel.com <lee@vercel.com>
Co-authored-by: 's avatarTim Neutkens <tim@timneutkens.nl>
parent 172a60ed
...@@ -49,7 +49,7 @@ The following options are available for the `turbo` configuration: ...@@ -49,7 +49,7 @@ The following options are available for the `turbo` configuration:
### Supported loaders ### Supported loaders
The following loaders have been tested to work with Turbopack's webpack loader implementation: The following loaders have been tested to work with Turbopack's webpack loader implementation, but many other webpack loaders should work as well even if not listed here:
- [`babel-loader`](https://www.npmjs.com/package/babel-loader) - [`babel-loader`](https://www.npmjs.com/package/babel-loader)
- [`@svgr/webpack`](https://www.npmjs.com/package/@svgr/webpack) - [`@svgr/webpack`](https://www.npmjs.com/package/@svgr/webpack)
...@@ -58,6 +58,7 @@ The following loaders have been tested to work with Turbopack's webpack loader i ...@@ -58,6 +58,7 @@ The following loaders have been tested to work with Turbopack's webpack loader i
- [`string-replace-loader`](https://www.npmjs.com/package/string-replace-loader) - [`string-replace-loader`](https://www.npmjs.com/package/string-replace-loader)
- [`raw-loader`](https://www.npmjs.com/package/raw-loader) - [`raw-loader`](https://www.npmjs.com/package/raw-loader)
- [`sass-loader`](https://www.npmjs.com/package/sass-loader) - [`sass-loader`](https://www.npmjs.com/package/sass-loader)
- [`graphql-tag/loader`](https://www.npmjs.com/package/graphql-tag)
## Examples ## Examples
...@@ -109,6 +110,28 @@ module.exports = { ...@@ -109,6 +110,28 @@ module.exports = {
} }
``` ```
For loaders that require configuration options, you can use an object format instead of a string:
```js filename="next.config.js"
module.exports = {
turbopack: {
rules: {
'*.svg': {
loaders: [
{
loader: '@svgr/webpack',
options: {
icon: true,
},
},
],
as: '*.js',
},
},
},
}
```
> **Good to know**: Prior to Next.js version 13.4.4, `turbo.rules` was named `turbo.loaders` and only accepted file extensions like `.mdx` instead of `*.mdx`. > **Good to know**: Prior to Next.js version 13.4.4, `turbo.rules` was named `turbo.loaders` and only accepted file extensions like `.mdx` instead of `*.mdx`.
### Resolving aliases ### Resolving aliases
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment