Skip to content

@tailwindcss/vite v4.0.1 not working Cannot read properties of undefined (reading 'includes') #16045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
peterhirn opened this issue Jan 30, 2025 · 8 comments · Fixed by #16052

Comments

@peterhirn
Copy link

peterhirn commented Jan 30, 2025

What version of Tailwind CSS are you using?

v4.0.1

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

@tailwindcss/vite

What version of Node.js are you using?

v23.6.1

What browser are you using?

All

What operating system are you using?

Linux

Reproduction URL

I understand that reproduction is required, I just don't have the time right now, sorry. Since this issue is extremely obvious I hope you can do without.

Describe your issue

TypeError: Cannot read properties of undefined (reading 'includes')
    at m (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/@tailwindcss+vite@4.0.1_vite@6.0.11_@types+node@22.12.0_jiti@2.4.2_lightningcss@1.29.1_terser@5.37.0_/node_modules/@tailwindcss/vite/dist/index.mjs:1:1599)
    at transformIndexHtml (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/@tailwindcss+vite@4.0.1_vite@6.0.11_@types+node@22.12.0_jiti@2.4.2_lightningcss@1.29.1_terser@5.37.0_/node_modules/@tailwindcss/vite/dist/index.mjs:1:3059)
    at getVitePluginAssets (/home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/vinxi@0.5.1_@types+node@22.12.0_ioredis@5.4.1_jiti@2.4.2_lightningcss@1.29.1_terser@5.37.0_typescript@5.7.3/node_modules/vinxi/lib/manifest/dev-server-manifest.js:186:39)
    at Object.assets (/home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/vinxi@0.5.1_@types+node@22.12.0_ioredis@5.4.1_jiti@2.4.2_lightningcss@1.29.1_terser@5.37.0_typescript@5.7.3/node_modules/vinxi/lib/manifest/dev-server-manifest.js:234:26)
    at async createPageEvent (/home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/@solidjs+start@1.0.11_@testing-library+jest-dom@6.6.3_solid-js@1.9.4_vinxi@0.5.1_@types+node@_fvmhuimud5ps5vjvpmm3ezrqsi/node_modules/@solidjs/start/dist/server/pageEvent.js:34:17)
    at async eval (/home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/@solidjs+start@1.0.11_@testing-library+jest-dom@6.6.3_solid-js@1.9.4_vinxi@0.5.1_@types+node@_fvmhuimud5ps5vjvpmm3ezrqsi/node_modules/@solidjs/start/dist/server/handler.js:37:25)
    at async _callHandler (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:1837:16)
    at async _callHandler (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:1837:16)
    at async _callHandler (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:1837:16)
    at async file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:1978:19
    at async Object.callAsync (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/unctx@2.4.0/node_modules/unctx/dist/index.mjs:72:16)
    at async Server.toNodeHandle (file:///home/peter/Projects/phi-ag/rvt-app/node_modules/.pnpm/h3@1.13.0/node_modules/h3/dist/index.mjs:2270:7)

Since there was only a single commit between 4.0 and 4.0.1 I assume the issue is this:

https://github.com/tailwindlabs/tailwindcss/pull/16005/files#diff-00d01a2d38f5f4253651cf9811eab1182c96f0307e78c567b803416e24b98165R70

@philipp-spiess
Copy link
Member

philipp-spiess commented Jan 30, 2025

@peterhirn Hey! Sorry for the crash.

Can you maybe share your dependency list so we can try to get a repro going? We can make this field nullable so it doesn't crash but based on the Vite typings, id should always be present so I think this might be either an older version of Vite or a Vite plugin we haven't considered. In either case it would be good to have a test case for this.

@peterhirn
Copy link
Author

Hey, thanks for looking into this. ❤️

This is one of the projects which fail at runtime (ie. pnpm dev): https://github.com/phi-ag/rvt-app

@philipp-spiess
Copy link
Member

philipp-spiess commented Jan 30, 2025

Seems like this happens with a SolidStart app. For some reason when using that we get a transformIndexHtml callback for a HTML file with the content / and no path whatsoever. Will fix and add an integration test. Odd one for sure! Thanks for the report.

Only happens in dev builds from what I can see too 🙈

@peterhirn
Copy link
Author

Thanks! SolidStart and TanStack Start are based on https://github.com/nksaraf/vinxi which is ... special 😁

@philipp-spiess
Copy link
Member

Just a quick head-sup that this will be fixed in the next release. You can try to use the insiders build which will have the fix available already:

npm install tailwindcss@insiders @tailwindcss/vite@insiders

@peterhirn
Copy link
Author

Great, thanks. I'm currently blocking the renovate automerge for v4.0.1 since v4.0 works fine.

Another thing I didn't mention yet: file auto-detection doesn't seem to work with SolidStart, I had to go back to explicit config: https://github.com/phi-ag/rvt-app/blob/main/tailwind.config.js#L7

I'll re-test this with the next release and open a new issue if necessary.

@philipp-spiess
Copy link
Member

Sounds good! Yeah I did find another issue with SolidStart that was causing the dev server to not work as expected. Let me know if there are still issues though!

@Constantor
Copy link

Just a quick head-sup that this will be fixed in the next release. You can try to use the insiders build which will have the fix available already:

npm install tailwindcss@insiders @tailwindcss/vite@insiders

Thank you very much for such a prompt fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants