Skip to content
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

babel-plugin-react-css-modules doesn't recognize the @ path #311

Open
cuihaoweb opened this issue Jun 19, 2023 · 0 comments
Open

babel-plugin-react-css-modules doesn't recognize the @ path #311

cuihaoweb opened this issue Jun 19, 2023 · 0 comments

Comments

@cuihaoweb
Copy link

cuihaoweb commented Jun 19, 2023

I added @/common/styles/init.css to man.jsx in the main entry file, but it gave me the following error message:

Error: Cannot find module '@/common/styles/init.css'
src/main.jsx
Require stack:
- /Users/cuihao04/Desktop/git/react-editor/node_modules/.pnpm/babel-plugin-react-css-modules@5.2.6_@babel+core@7.22.1/node_modules/babel-plugin-react-css-modules/dist/index.js

But I've already configured the @ configuration in webpack,
Here's the babel-plugin-react-css-modules configuration:

 plugins: [
        [
            "react-css-modules",
            {   
                context: resolve(__dirname, './src'),
                exclude: 'node_modules',
                generateScopedName: '[path]__[name]__[local]',
                webpackHotModuleReloading: true,
                filetypes: {
                    '.less': {
                        "syntax": "postcss-less"
                    },
                    '.css': {
                        syntax: 'postcss-styled'
                    }
                }
            }
        ]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant