Skip to content

Cannot use absolute paths for importing css files #193

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

Open
shettayyy opened this issue Aug 8, 2018 · 1 comment
Open

Cannot use absolute paths for importing css files #193

shettayyy opened this issue Aug 8, 2018 · 1 comment

Comments

@shettayyy
Copy link

shettayyy commented Aug 8, 2018

{
  "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), 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?

@ramesaliyev
Copy link

ramesaliyev commented Aug 15, 2018

Well, same here. I'm also having this issue for a while.

Edit: I think this issue caused by #25

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

2 participants