tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

@tailwindcss/postcss 4.1.6 with @parcel/transformer-postcss: Cannot read properties of undefined (reading 'input')

Open vincent7128 opened this issue 1 year ago • 4 comments

What version of Tailwind CSS are you using?

tailwindcss: 4.1.7

What build tool (or framework if it abstracts the build tool) are you using?

parcel 2.15.1

What version of Node.js are you using?

v22.14.0

What browser are you using?

Safari

What operating system are you using?

macOS

Describe your issue

{
  "name": "test",
  "version": "0.0.0",
  "source": "src/index.html",
  "scripts": {
    "start": "parcel",
    "build": "parcel build"
  },
  "staticFiles": {
    "staticPath": "src/img",
    "distDir": "dist/img"
  },
  "devDependencies": {
    "@tailwindcss/postcss": "4.1.6",
    "parcel": "^2.15.1",
    "parcel-reporter-static-files-copy": "^1.5.3",
    "tailwindcss": "^4.1.7"
  }
}

When use over @tailwindcss/postcss 4.1.5, run npm start I got follow message:

🚨 Build failed.

@parcel/transformer-postcss: Cannot read properties of undefined (reading 'input')

  TypeError: Cannot read properties of undefined (reading 'input')
      at Comment.toJSON (/package/node_modules/postcss/lib/node.js:387:40)
      at /package/node_modules/postcss/lib/node.js:379:22
      at Array.map (<anonymous>)
      at Root.toJSON (/package/node_modules/postcss/lib/node.js:377:29)
      at Object.transform (/package/node_modules/@parcel/transformer-postcss/lib/PostCSSTransformer.js:244:21)
      at async Transformation.runTransformer (/package/node_modules/@parcel/core/lib/Transformation.js:486:5)
      at async Transformation.runPipeline (/package/node_modules/@parcel/core/lib/Transformation.js:303:36)
      at async Transformation.runPipelines (/package/node_modules/@parcel/core/lib/Transformation.js:215:16)
      at async Transformation.runPipelines (/package/node_modules/@parcel/core/lib/Transformation.js:245:34)
      at async Transformation.run (/package/node_modules/@parcel/core/lib/Transformation.js:143:21)

vincent7128 avatar May 19 '25 13:05 vincent7128

Please provide a git repo that reproduces the issue so we can troubleshoot for you, thanks!

wongjn avatar May 19 '25 13:05 wongjn

I know the issue here. Will be looking at this today.

thecrypticace avatar May 19 '25 13:05 thecrypticace

This will be fixed in the next release (likely will push one out this week).

In about 20–30 minutes you should be able to test it using our insiders build:

npm install tailwindcss@insiders

thecrypticace avatar May 19 '25 15:05 thecrypticace

Amazing! Thanks for the fix - this has been plaguing me for the last couple of weeks.

fyi, until the official release, you must install both in order to test the fix properly:

npm install tailwindcss@insiders
npm install @tailwindcss/postcss@insiders

Strangely, my build process always worked, it was only when running watch that I got this error.

package.json excerpt:

  "scripts": {
    "build": "parcel build",    <<< this worked
    "watch": "parcel watch"     <<< this failed
  }

Anyhow, thanks again.

keefer1707 avatar May 22 '25 23:05 keefer1707