Skip to content

Commit 4dec7a5

Browse files
assertchrisgajus
authored andcommitted
docs: add react-native custom extension note to readme (gajus#141)
This took me an age to work out.
1 parent 2586615 commit 4dec7a5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ In contrast to [`react-css-modules`](https://github.com/gajus/react-css-modules)
2222
* [Configuration](#configuration)
2323
* [Configurate syntax loaders](#configurate-syntax-loaders)
2424
* [Installation](#installation)
25+
* [React Native](#react-native)
2526
* [Demo](#demo)
2627
* [Example transpilations](#example-transpilations)
2728
* [Anonymous `styleName` resolution](#anonymous-stylename-resolution)
@@ -257,6 +258,21 @@ When `babel-plugin-react-css-modules` cannot resolve CSS module at a compile tim
257258
npm install babel-plugin-react-css-modules --save
258259
```
259260

261+
262+
### React Native
263+
264+
If you'd like to get this working in React Native, you're going to have to allow custom import extensions, via a `rn-cli.config.js` file:
265+
266+
```js
267+
module.exports = {
268+
getAssetExts() {
269+
return ["scss"];
270+
}
271+
}
272+
```
273+
274+
Remember, also, that the bundler caches things like plugins and presets. If you want to change your `.babelrc` (to add this plugin) then you'll want to add the `--reset-cache` flag to the end of the package command.
275+
260276
### Demo
261277

262278
```bash

0 commit comments

Comments
 (0)