tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

error on interpreting @plugin in css file

Open stalexxx opened this issue 7 months ago • 2 comments

Phoenixframework with no nodejs v4.0.9-4.1.4 tailwindcss-macos-arm64 binary from https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-macos-arm64

...
@plugin "../vendor/daisyui" {
  themes: false;
}

Then i am doing


❯ ./tailwindcss-macos-arm64 -v
...
≈ tailwindcss v4.1.4

Done in 514ms

❯ ./tailwindcss-macos-arm64 -i  ./assets/css/app.css  -o priv/static/assets/css/app.css
Error: The plugin "../vendor/daisyui" does not accept options

but

as soon as I am changing to

@plugin "../vendor/daisyui";

i am getting

❯ ./tailwindcss-macos-arm64 -i  ./assets/css/app.css  -o priv/static/assets/css/app.css
TypeError: handler is not a function. (In 'handler(pluginApi)', 'handler' is an instance of Object)

i made reproducing repo https://github.com/stalexxx/tailwind_plugin_case

That is wierd, cause i tried on different env (linux) and both are not reproducing

stalexxx avatar Apr 26 '25 06:04 stalexxx

Hey there! I was trying to run this on my ARM mac and it seems fine (I have to comment out the heroicons plugin though since that is loading a dependency that isn't there):

Image

Are you on an Intel Mac?

philipp-spiess avatar May 09 '25 10:05 philipp-spiess

I could reproduce this error. Same phoenix version. Same tailwind version. Same Mac.

I did it by adding a package.json and package-lock.json to root folder. By removing them the error stops happening. I am using a tool that adds package.json and package-lock.json to the root of the project.

prem-prakash avatar May 17 '25 23:05 prem-prakash

This appears to happen when vendoring the CJS build of Daisy UI in a type: "module" project. You'll want to vendor the ESM build instead.

It causes an object with a default export instead of the actual exports object to show up. And in Node this doesn't even work: In Node.js this doesn't even work:

Image

thecrypticace avatar Sep 18 '25 21:09 thecrypticace