From 7cb45c1eccc0fcab03bb3612dce35d0aef0d8b39 Mon Sep 17 00:00:00 2001 From: Christopher Pitt Date: Mon, 27 Nov 2017 13:22:39 +0200 Subject: [PATCH] Add RN custom extension note to readme This took me an age to work out. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 0fc85b2..18c882d 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ In contrast to [`react-css-modules`](https://github.com/gajus/react-css-modules) * [Configuration](#configuration) * [Configurate syntax loaders](#configurate-syntax-loaders) * [Installation](#installation) + * [React Native](#react-native) * [Demo](#demo) * [Example transpilations](#example-transpilations) * [Anonymous `styleName` resolution](#anonymous-stylename-resolution) @@ -257,6 +258,21 @@ When `babel-plugin-react-css-modules` cannot resolve CSS module at a compile tim npm install babel-plugin-react-css-modules --save ``` + +### React Native + +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: + +```js +module.exports = { + getAssetExts() { + return ["scss"]; + } +} +``` + +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. + ### Demo ```bash