Cannot find module X [plugin:vite:css] [postcss]

160 views Asked by At

When I try to simply re-export the file, it shows this error

// src/pages/login/page.tsx:
export const LoginPage = () => {...}

// src/pages/index.ts:
export { LoginPage } from './login/page' // error occurs in this line

[plugin:vite:css] [postcss] Cannot find module './page' Require stack: src/pages/index.ts

postcss.config.cjs:

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},

    'postcss-preset-mantine': {},
    'postcss-simple-vars': {
      variables: {
        'mantine-breakpoint-xs': '36em',
        'mantine-breakpoint-sm': '48em',
        'mantine-breakpoint-md': '62em',
        'mantine-breakpoint-lg': '75em',
        'mantine-breakpoint-xl': '88em',
      },
    },
  },
};
1

There are 1 answers

0
Lust On

Solved the issue by removing the line 'type: module' in the package.json and renaming the extension of the config files from .js to .mjs