I have the following .babelrc
in the root directory of a React project that I build with Webpack (created with create-react-app).
{
"presets": ["react-app", "env"],
"plugins": [
[
"react-intl",
{
"messagesDir": "./public/messages/"
}
]
]
}
When I run the build, I get the following error
Syntax error: Missing class properties transform.
1 | export default class ValidationUtils {
> 2 | static isPhoneNumber = 'whatever'
| ^
3 | }
If I remove "env"
from the presets list I no longer get this error, but instead, I get an error that complains about the usage of an ES6 import
in a script that is run as part of the build
/apps/my-app/scripts/mergeMessages.js:3
import * as fs from "fs";
^^^^^^
SyntaxError: Unexpected token import
Is there some presets setting (or anything else) that will overcome both of these issues?