Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ The following options are available for the `turbopack` configuration:
| `rules` | List of supported webpack loaders to apply when running with Turbopack. |
| `resolveAlias` | Map aliased imports to modules to load in their place. |
| `resolveExtensions` | List of extensions to resolve when importing files. |
| `debugIds` | Enable generation of debug IDs in JavaScript bundles and source maps. |

### Supported loaders

Expand Down Expand Up @@ -252,12 +253,48 @@ module.exports = {

This overwrites the original resolve extensions with the provided list. Make sure to include the default extensions.

### Debug IDs

Debug IDs provide stable identifiers for JavaScript bundles and source maps that help with debugging and error tracking. When enabled, Turbopack adds debug ID comments to generated JavaScript files and includes debug ID properties in source maps, following the [TC39 Debug ID proposal](https://github.com/tc39/ecma426/blob/main/proposals/debug-id.md).

To enable debug IDs, set `debugIds` to `true`:

```js filename="next.config.js"
module.exports = {
turbopack: {
debugIds: true,
},
}
```

When enabled, your generated JavaScript files will include debug ID comments:

```js
// globalThis._debugIds[<this-scri[pt>] = "12345678-1234-1234-1234-123456789abc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// globalThis._debugIds[<this-scri[pt>] = "12345678-1234-1234-1234-123456789abc"
// globalThis._debugIds[(new Error).stack] = "12345678-1234-1234-1234-123456789abc"

The code example contains a syntax error with malformed brackets: [<this-scri[pt>] should be [<this-script>] or replaced with the actual implementation format.

View Details

Analysis

Documentation syntax error in debug IDs example

What fails: The code example in docs/01-app/03-api-reference/05-config/01-next-config-js/turbopack.mdx line 273 contains malformed JavaScript syntax: [<this-scri[pt>] with an extra opening bracket

How to reproduce: View the documentation file at line 273, which shows:

// globalThis._debugIds[<this-scri[pt>] = "12345678-1234-1234-1234-123456789abc"

Result: The malformed brackets [<this-scri[pt>] make the example invalid JavaScript syntax, confusing readers

Expected: Should show valid JavaScript syntax. Based on the actual implementation in turbopack/crates/turbopack-core/src/code_builder.rs lines 76-85, the correct syntax uses (new Error).stack as the key:

// globalThis._debugIds[(new Error).stack] = "12345678-1234-1234-1234-123456789abc"

// Your bundled code here...

//# debugId=12345678-1234-1234-1234-123456789abc
//# sourceMappingURL=your-bundle.js.map
```

Source maps will also include the `debugId` property:

```json
{
"version": 3,
"sources": ["..."],
"debugId": "12345678-1234-1234-1234-123456789abc"
}
```

Error handling services like Sentry can leverage this metadata to improve deobfuscation reliability.

For more information and guidance for how to migrate your app to Turbopack from webpack, see [Turbopack's documentation on webpack compatibility](https://turbo.build/pack/docs/migrating-from-webpack).

## Version History

| Version | Changes |
| -------- | ----------------------------------------------- |
| `16.0.0` | `turbopack.rules.*.condition` was added. |
| `15.3.0` | `experimental.turbo` is changed to `turbopack`. |
| `13.0.0` | `experimental.turbo` introduced. |
| Version | Changes |
| -------- | ------------------------------------------------------------------ |
| `16.0.0` | `turbopack.rules.*.condition` and `turbopack.debugIds` were added. |
| `15.3.0` | `experimental.turbo` is changed to `turbopack`. |
| `13.0.0` | `experimental.turbo` introduced. |
Loading