我想让 babel 从节点模块中转译我的包。
我已经阅读了一些人们尝试这个的问题,但现在它似乎又被打破了。看看其他人是否同意,或者我做错了什么会很好。
我的代码还没有包含我的模块,而且它可以正常工作。
运行babel-node --ignore '/node_modules/'
也没有问题。如果我运行babel-node --ignore '/node_modules/(?!my-node-module)'
我会收到以下错误。
错误
[HPM] Error occurred while trying to proxy request /search/red from localhost:3000 to http://localhost:9000 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
/Users/petermouland/dev/argos/ui-search/node_modules/babel-core/lib/transformation/file/options/option-manager.js:328
throw e;
^
Error: Options {"loose":true} passed to /Users/petermouland/dev/argos/ui-search/node_modules/babel-preset-env/lib/index.js which does not accept options. (While processing preset: "/Users/petermouland/dev/argos/ui-search/node_modules/babel-preset-env/lib/index.js") (While processing preset: "/Users/petermouland/dev/argos/ui-search/node_modules/babel-preset-env/lib/index.js") (While processing preset: "/Users/petermouland/dev/argos/ui-search/node_modules/babel-preset-react/lib/index.js")
.babelrc
{
"sourceMaps": true,
"presets": ["react", ["env", {
"targets": {
"browsers": [
"safari >= 9",
"ie 11",
"last 2 Chrome versions",
"last 2 Firefox versions",
"edge 13",
"ios_saf 9.0-9.2",
"ie_mob 11",
"Android >= 4"
],
"node": "current",
"debug": false,
"loose": false,
"modules": false,
"useBuiltIns": true
}
}]],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
"transform-object-assign"
],
"env": {
"test": {
"plugins": [["istanbul", {
"exclude": ["**/*.spec.js"]
}]]
}
}
}
ignore
有没有其他人有这个问题,或者我应该使用的命令有改进吗?