redwoodjs / redwood

The App Framework for Startups
https://redwoodjs.com
MIT License
17.08k stars 980 forks source link

[Bug?]: Tailwind setup is broken #9035

Open hacknaked opened 1 year ago

hacknaked commented 1 year ago

What's not working?

A working Redwood environment is broken after setting up Tailwind.

How do we reproduce the bug?

  1. Create a new RW app from scratch:
    $ yarn create redwood-app --ts ./redwoodblog
    $ cd redwoodblog/
    $ yarn install
  2. Setup Tailwind:
    $ yarn rw setup ui tailwindcss
  3. Try to create a new page:
    $ yarn redwood generate page home /

Failure error

Reverted because: Error applying template at /home/fernando/git/test/redwoodblog/node_modules/@redwoodjs/cli/dist/co
  mmands/generate/page/templates/page.tsx.template for home: require() of ES Module
  /home/fernando/git/test/redwoodblog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs not supported.
  Instead change the require of
  /home/fernando/git/test/redwoodblog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs to a dynamic import()
  which is available in all CommonJS modules.
◼ Updating routes file...
◼ Generating types...
◼ One more thing...
Error applying template at /home/fernando/git/test/redwoodblog/node_modules/@redwoodjs/cli/dist/commands/generate/page/templates/page.tsx.template for home: require() of ES Module /home/fernando/git/test/redwoodblog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs not supported.
Instead change the require of /home/fernando/git/test/redwoodblog/node_modules/prettier-plugin-tailwindcss/dist/index.mjs to a dynamic import() which is available in all CommonJS modules.

Workaround

Downgrade the prettier-plugin-tailwindcss from "^0.5.2" to "0.4.1" in the root package.json file.

What's your environment? (If it applies)

System:
    OS: Linux 6.2 Ubuntu 23.04 23.04 (Lunar Lobster)
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 18.16.0 - /tmp/xfs-df99cf2c/node
    Yarn: 3.6.1 - /tmp/xfs-df99cf2c/yarn
  Browsers:
    Chrome: 113.0.5672.126
  npmPackages:
    @redwoodjs/core: 6.0.6 => 6.0.6

Are you interested in working on this?

BlackHawkSigma commented 1 year ago

I think one of the problems is that prettier-plugin-tailwindcss >= v0.5 only supports prettier >= v3