gajus / gajus/babel-plugin-react-css-modules

Cannot use absolute paths for importing css files

Open
#193 1 comment 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
159
PR merge metrics
No merged PRs in 30d

Description

```
{
"presets": ["env", "react"],
"plugins": [
"transform-runtime",
"transform-object-rest-spread",
"react-hot-loader/babel",
"syntax-dynamic-import",
"universal-import",
[
"react-css-modules",
// https://github.com/gajus/babel-plugin-react-css-modules
{
"exclude": "node_modules",
"webpackHotModuleReloading": true,
"handleMissingStyleName": "warn",
"generateScopedName": "[name]__[local]___[hash:base64:5]",
"filetypes": {
".pcss": {
"syntax": "postcss-scss"
}
}
}
]
]
}
```
I tried using the context property but it didn't solve my issue.

Imports like:

`import './styles/main.pcss';` works.

but

`import 'src/styles/main.pcss';` doesn't work.

In the post([https://www.jjinux.com/2018/04/javascript-porting-from-react-css.html](https://www.jjinux.com/2018/04/javascript-porting-from-react-css.html)), I read that the plugin isn't very good at respecting webpack resolver. Are there any plans to provide support for this feature or is there a way to configure the plugin to resolve paths?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.