我想让babel从node-modules中转发我的包。
我已经读过人们试图解决的一些问题,但现在它似乎又被打破了。很高兴看到其他人是否同意,或者我是否做错了什么。
我的代码还没有包含我的模块,因为它没有任何问题。
运行func textView(_ textView: TextViewX, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool
{
let newText = (textView.text as NSString).replacingCharacters(in: range, with: text)
let numberOfChars = newText.characters.count
return numberOfChars < 200
}
func textViewDidChange(textView: TextViewX)
{
let currentCharacterCount = 200 - textView.text.characters.count
if currentCharacterCount >= 30 {
descriptionCharacterCountLabel.text = "\(200 - textView.text.characters.count)"
}
else
{
descriptionCharacterCountLabel.textColor = UIColor.red
descriptionCharacterCountLabel.text = "\(200 - textView.text.characters.count)"
}
}
也没有问题。
如果我运行babel-node --ignore '/node_modules/'
我就会收到以下错误。
错误
babel-node --ignore '/node_modules/(?!my-node-module)'
.babelrc
[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")
&#13;
是否有其他人遇到此问题,或者我应该使用的{
"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"]
}]]
}
}
}
命令是否有改进?