-
-
Notifications
You must be signed in to change notification settings - Fork 161
This plugin should not take over webpack's native module resolve #25
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
Comments
Can you please fork the demo and reproduce the issue? https://github.com/gajus/babel-plugin-react-css-modules/tree/master/demo This plugin does not rewrite the imports and it is not aware of webpack at all. Something else is breaking. I am closing this until there is a fork reproducing the issue. |
This issue appears to be caused by this line. Specifically, I'm not sure this can be fixed by the plugin unless there's a new configuration option. You should be able to set |
It can. It should simply lookup the |
Is it possible for a Babel plugin to read the webpack config without the user explicitly passing it in? |
Oh, sorry – I got lost between projects. I thought I am looking at an issue of https://github.com/gajus/isomorphic-webpack. Please ignore me. |
No problem. 😹 On the bright side, that project looks like exactly what I was looking for. |
There is this babel plugin which mimics that resolve feature of webpack. https://github.com/tleunen/babel-plugin-module-resolver If this css modules can take advantage of that, it could be a solution. |
First of all thanks for an amazing plugin. We have decided to use this plugin in our app but this issue is a blocker for us. We defined some aliases in our webpack configuration and it doesn't respect them and throws error as shown below. I tried using babel-plugin-module-resolver as suggested by @craigcosmo but that also didn't work. Let me know if you need any further information from our end. Error :
Webpack Resolve configuration :
babelrc configuration :
|
Well, if you import inside CSS and not in JS, you will get Webpack aliases working as css-loader etc is already in webpack scope. We are using less so for us it is as simple as |
Bump. Blocker for me too. |
Does anybody have any workaround for this? I'm okay with even most uglier ones. |
I ran into a similar issue on Windows (only in some situations) and just used |
Ran into similar issue ( My webpack config is in
{
"plugins": [
["module-resolver", {
"alias": {
"@": "./client",
}
}],
["react-css-modules", {
"webpackHotModuleReloading": true,
"filetypes": {
".pcss": {
"syntax": ""
}
}
}]
]
}
module.exports = {
// ...
resolve: {
alias: {
'@': path.resolve(__dirname, 'client'),
},
},
} Now I can use aliased CSS imports in my
import '@/styles/index.pcss'; // is properly imported as ./client/styles/index.pcss |
one of my webpack property looks like this
I set up webpack config like that, so I can do this
It was perfect for my need. Until I installed
babel-plugin-react-css-modules
to my project.Now When I do this
I got a bunch of errors like below
As you can see now, webpack doesn't know where my modules are.
The text was updated successfully, but these errors were encountered: