Skip to content

Tailwind config throws Module not found on Next.js 16.1.1 (works on 16.0) #87898

@carloitaben

Description

@carloitaben

Hello! I have some custom Tailwind v3 plugins that I import in my tailwind.config.ts file. After upgrading to version 16.1, I began encountering Module not found errors. I have created a reproduction below.

Link to the code that reproduces this issue

https://github.com/carloitaben/test-repro-next-16-tw

To Reproduce

  1. pnpm i
  2. pnpm dev
  3. Open http://localhost:3000

Current vs. Expected behavior

With Next.js 16.1.1:

⚠ ./tailwind.config.ts:2:1
Module not found: Can't resolve './src/lib/tailwind'
  1 | import type { Config } from "tailwindcss";
> 2 | import { someCustomPlugin } from "./src/lib/tailwind";
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  3 |
  4 | export default {
  5 |   content: ["./src/**/*.{ts,tsx}"],
Image

Downgrading to 16.0.10 or adding the --webpack flag removes the errors:
Image

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10
Binaries:
  Node: 20.10.0
  npm: 10.2.3
  Yarn: N/A
  pnpm: 9.15.9
Relevant Packages:
  next: 16.1.1 // Latest available version is detected (16.1.1).
  eslint-config-next: N/A
  react: 19.2.3
  react-dom: 19.2.3
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

The error does not seem to break the build, and the code continues to function. I believe this is a Turbopack issue introduced in this minor version as running the scripts with the --webpack flags removes the error.

I've also tested this on the latest canary version (currently 16.1.1-canary.8), which exhibits the same behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions