こんなのにハマってしまった。
$ npx babel xxx.js -o xxx.compat.js ReferenceError: [BABEL] /path/to/xxx.js: Unknown option: .targets. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options. …
間違った設定 in package.json :
{
…
"babel": {
"presets": [
"@babel/env",
{
"targets": {
"ie": "11"
}
}
]
}
}
修正後:
{
…
"babel": {
"presets": [
["@babel/env",
{
"targets": {
"ie": "11"
}
}]
]
}
}
presets の値を ["@babel/env", {…}] から [["@babel/env", {…}]] にしました。env の設定なんだねー。