Skip to content

Generating types breaks with Tailwind CSS v3.3 #44

@xeho91

Description

@xeho91

Hi,

thank you for this fantastic tool ❤️

In the version 3.3 of Tailwind CSS, they added a support for ESM and TypeScript config.

I've changed my config to ESM, and rename it to tailwind.config.ts.
I am trying to generate the types with the following command:

pnpm typewind generate

then I get the following error:

$ pnpm typewind generate
/home/xeho91/<redacted>/tailwind.config.ts:1
import pluginAspectRatio from "@tailwindcss/aspect-ratio";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1176:20)
    at Module._compile (node:internal/modules/cjs/loader:1218:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at createTypewindContext (/home/xeho91/<redacted>/node_modules/typewind/dist/cli.js:72:56)
    at generateTypes (/home/xeho91/<redacted>/node_modules/typewind/dist/cli.js:155:15)

Additional information

My project has type set to module in package.json file.

// package.json
{
  ...
  "type": "module",
  ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions