Skip to content

Commit

Permalink
Local monorepo packages may also need to be transpiled
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis committed Nov 7, 2023
1 parent 6ef7ba0 commit 9d6f9b6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion site/docs/integrations/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ Each integration will set a default value based on the configuration options pas

## Transpiling Vanilla Extract-dependent Libraries

If your Next.js application depends on a library from `node_modules`, and that library styles its components with Vanilla Extract, but does _not_ compile its styles (i.e. it ships `.css.js/ts` files), then that library needs to be added to `transpilePackages` in your Next.js config:
By default, Next.js does not allow importing of TypeScript files outside of the app root.

If your application depends on a TypeScript library, either via a local package within a monorepo or a dependnecy inside `node_modules`, and that library styles its components with Vanilla Extract, but does _not_ compile its styles, then that library needs to be added to [`transpilePackages`] in your Next.js config:

```tsx
// App.tsx
Expand All @@ -92,3 +94,5 @@ const nextConfig = {
// Next.js Vanilla Extract integration will now compile @company/design-system styles
module.exports = createVanillaExtractPlugin(nextConfig);
```

[`transpilepackages`]: https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages

0 comments on commit 9d6f9b6

Please sign in to comment.