tailwindlabs / tailwindcss-forms

A plugin that provides a basic reset for form styles that makes form elements easy to override with utilities.
https://tailwindcss-forms.vercel.app
MIT License
4.15k stars 219 forks source link

next.js | Error: Cannot find module '@tailwindcss/forms' #139

Closed fabmade closed 1 year ago

fabmade commented 1 year ago

What version of @tailwindcss/forms are you using?

v0.5.3

What version of Node.js are you using?

18

What browser are you using?

Chrom

What operating system are you using?

alpine

Reproduction repository

-

Describe your issue

If i add the @tailwindcss/forms to the devDependencies i will get this error on production. This will not happen, if i add it to the dependencies section.

Error: Cannot find module '@tailwindcss/forms'
--
Thu, Jul 6 2023 9:47:50 am | Require stack:
Thu, Jul 6 2023 9:47:50 am | - /app/build/server/pages/producer/[producer]/shop.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/server/require.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/server/next-server.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/server/next.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/server/lib/start-server.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/cli/next-start.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/lib/commands.js
Thu, Jul 6 2023 9:47:50 am | - /app/node_modules/next/dist/bin/next
Thu, Jul 6 2023 9:47:50 am | at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
Thu, Jul 6 2023 9:47:50 am | at mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:23:32)
Thu, Jul 6 2023 9:47:50 am | at Module._load (node:internal/modules/cjs/loader:922:27)
Thu, Jul 6 2023 9:47:50 am | at Module.require (node:internal/modules/cjs/loader:1143:19)
Thu, Jul 6 2023 9:47:50 am | at require (node:internal/modules/cjs/helpers:110:18)
Thu, Jul 6 2023 9:47:50 am | at 9920 (/app/build/server/pages/producer/[producer]/shop.js:1273:18)
Thu, Jul 6 2023 9:47:50 am | at __webpack_require__ (/app/build/server/webpack-runtime.js:25:42)
Thu, Jul 6 2023 9:47:50 am | at 5490 (/app/build/server/pages/producer/[producer]/shop.js:1256:9)
Thu, Jul 6 2023 9:47:50 am | at __webpack_require__ (/app/build/server/webpack-runtime.js:25:42)
Thu, Jul 6 2023 9:47:50 am | at 6903 (/app/build/server/pages/producer/[producer]/shop.js:515:23) {
Thu, Jul 6 2023 9:47:50 am | code: 'MODULE_NOT_FOUND',
Thu, Jul 6 2023 9:47:50 am | requireStack: [
Thu, Jul 6 2023 9:47:50 am | '/app/build/server/pages/producer/[producer]/shop.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/server/require.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/server/next-server.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/server/next.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/server/lib/start-server.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/cli/next-start.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/lib/commands.js',
Thu, Jul 6 2023 9:47:50 am | '/app/node_modules/next/dist/bin/next'
Thu, Jul 6 2023 9:47:50 am | ]
Thu, Jul 6 2023 9:47:50 am | }
RobinMalfait commented 1 year ago

Hey, thank you for this bug report! 🙏

This is likely because devDependencies are not installed whenever you deploy. If you ensure those are installed then it should work.

There is no harm in adding this to your normal dependencies if that solves the problem for you.

Going to close this for now. If this is still an issue, please open a new issue with a minimal reproduction repo attached (or attach a reproduction to this issue and I will re-open it) so that we can take a look at what's going on.