These are some example configurations, but make sure to provide your versions and other configurations to clarify.
Note: I do not have tailwind: true
in my remix.config.cjs
I suspect the issue may be related to using CJS imports in ESM types.
Please take note - this is written in ESM (not CommonJS) style and the package.json also includes the module
type.
postcss.config.js
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
export default {
plugins: {
'postcss-import': {},
tailwindcss: {
config: __dirname + '/tailwind.config.ts',
},
autoprefixer: {},
},
};
tailwind.config.ts
import type { Config } from 'tailwindcss';
...
// just variables/functions/etc
remix.config.cjs
const isProd = process.env.NODE_ENV === 'production';
/** @type {import('@remix-run/dev').AppConfig} */
const config = {
postcss: true,
ignoredRouteFiles: ['**/.*'],
serverMinify: isProd,
appDirectory: 'src',
browserNodeBuiltinsPolyfill: { modules: { process: true } },
serverDependenciesToBundle: [
'remix-utils/client-only',
'axios',
],
routes(defineRoutes) {
return defineRoutes((route) => {
...
});
},
};
module.exports = config;