Skip to content

Commit

Permalink
Add babel-preset-const-enum to README.md
Browse files Browse the repository at this point in the history
Resolves: #2, #3
  • Loading branch information
kevin-lau-kr committed Oct 23, 2019
1 parent a2f1f3d commit e60fa28
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,21 @@ const MyEnum = {
]
}
```

## Troubleshooting

### `SyntaxError`

You may be getting a `SyntaxError` because you are running this plugin on
non-TypeScript source. You might have run into this problem in `react-native`,
see:<br>
[babel-plugin-const-enum#2](https://github.com/dosentmatter/babel-plugin-const-enum/issues/2)<br>
[babel-plugin-const-enum#3](https://github.com/dosentmatter/babel-plugin-const-enum/issues/3)

This seems to be caused by `react-native` transpiling
[`flow`](https://flow.org/) code in `node_modules`.
To fix this issue, please use
[`babel-preset-const-enum`](https://github.com/dosentmatter/babel-preset-const-enum)
to only run `babel-plugin-const-enum` on TypeScript files.
If you wish to fix the issue manually, check out the
[solution in babel-plugin-const-enum#2](https://github.com/dosentmatter/babel-plugin-const-enum/issues/2#issuecomment-542859348).

0 comments on commit e60fa28

Please sign in to comment.