Skip to content

Commit f1f8335

Browse files
authored
Merge pull request #86 from oklas/oklas-patch-swc
docs: using swc
2 parents 9452a82 + 28b8653 commit f1f8335

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,27 @@ and replace `react-scripts` in `package.json`:
195195

196196
See also experimental [autoscan](https://github.com/oklas/react-app-alias/issues/70) feature
197197

198+
### Using SWC etc
198199

199-
#### API
200+
Plugin SWC must be declared in plugin section before alias plugn. This is because
201+
SWC plugn recreate SWC configuration instead of babel configuration. Both babel and
202+
swc configurations originally without alias configuration. So to configure alias,
203+
alias plugin must be aplied after SWC plugin:
204+
205+
```js
206+
const { CracoAliasPlugin } = require('react-app-alias');
207+
const CracoSwcPlugin = require('craco-swc');
208+
209+
module.exports = {
210+
plugins: [
211+
{ plugin: CracoSwcPlugin },
212+
{ plugin: CracoAliasPlugin },
213+
],
214+
}
215+
```
216+
217+
218+
### API
200219

201220
* **options**
202221

0 commit comments

Comments
 (0)