gajus / babel-plugin-react-css-modules

Transforms styleName to className using compile time CSS module resolution.
Other
2.05k stars 162 forks source link

babelrc example #99

Closed nemoisfree closed 7 years ago

nemoisfree commented 7 years ago

Hello. How to tune .babelrc file, i didn't find it in documentation.

my .babelrc not working

"plugins": [["babel-plugin-react-css-modules", {
    "filetypes": "postcss-scss"
  }]]
anhuiliujun commented 7 years ago

@nemoisfree I meet the same problem, how to tune .babelrc file

gajus commented 7 years ago

@nemoisfree Please share your findings with @anhuiliujun

nemoisfree commented 7 years ago

@anhuiliujun @gajus try babelrc file { "presets": [ ["es2015"] ], "plugins": [ "transform-react-jsx", ["react-css-modules", { "filetypes": { ".scss": "postcss-scss", }} ] ] } or webpack2 config https://github.com/gajus/babel-plugin-react-css-modules/blob/master/demo/webpack.config.js

mnowotnik commented 7 years ago

This babelrc snippet above throws error:

[ { keyword: 'type',
    dataPath: '.filetypes[\'.scss\']',
    schemaPath: '#/properties/filetypes/patternProperties/%5C..*/type',
    params: { type: 'object' },
    message: 'should be object' } ]
Nantris commented 6 years ago

Same exact issue as @Mike-Now

Edit: This seems to be the solution: https://github.com/gajus/babel-plugin-react-css-modules/issues/104#issuecomment-309612178