我或多或少对我正确设置babel配置很有信心。运行./node_modules/.bin/babel src --out-dir lib
时,会创建lib
目录,但是对于给定的输入(src/index.js
)
// @flow
import functions from 'firebase-functions'
console.log(functions)
产生的输出是
// @flow
import functions from 'firebase-functions';
console.log(functions);
考虑到我定位到不支持import
的节点v6,这是不正确的
package.json
"devDependencies": {
"@babel/cli": "7.0.0-beta.53",
"@babel/preset-flow": "7.0.0-beta.53",
"@babel/preset-env": "7.0.0-beta.53"
}
.babelrc
{
"presets": [
"@babel/preset-flow",
["@babel/preset-env", {
"targets": {
"node": "6.14"
}
}]
]
}