Skip to content

Tailwind CSS 4 Integration Fails with ESM Errors #143

@ThisIsMrAli

Description

@ThisIsMrAli

Description

When attempting to integrate Tailwind CSS 4 with a Bolt-CEP project, the build process fails with ESM-related errors.

Steps to Reproduce

  1. Create or use an existing Bolt-CEP project
  2. Install Tailwind CSS 4
  3. Attempt to run the development server

Error Details

node_modules/esbuild/lib/main.js:1373:27: ERROR: [plugin: externalize-deps] Failed to resolve "@tailwindcss/vite". This package is ESM only but it was tried to load by require. See http://vitejs.dev/guide/troubleshooting.html#this-package-is-esm-only for more details.

Environment

  • Bolt-CEP version: Using vite-cep-plugin v1.1.12
  • Node.js version: v18.17.0
  • Operating System: macOS (darwin 24.3.0)
  • tailwindcss version: 4.1.2
  • @tailwindcss/vite: 4.1.2

Notes

The error suggests that the build system is trying to use CommonJS require() to load an ESM-only package (@tailwindcss/vite). Tailwind CSS 4 has migrated to ESM-only modules, which is causing compatibility issues with Bolt-CEP's build system that likely expects CommonJS modules. According to the Vite troubleshooting guide, this indicates a module compatibility issue between ESM and CommonJS modules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions