我npm link
在父仓库(A)上使用链接子仓库(B)。
工作正常,npm link
但 Repo A 正在使用 babel 转换代码,并且似乎忽略了node_modules
依赖项或符号链接。
我的回购 B 中有一个扩展运算符,我收到以下错误:
SyntaxError: .../www/adept-him-models/models/event/model.js: Unexpected token (78:10)
76 | return full
77 | ? {
> 78 | ...view,
| ^
79 | // add properties for a full view
80 | }
81 | : view;
有趣的是我使用的是节点版本 9.4.0,它应该原生支持这个。
我package.json
的依赖:
"devDependencies": {
"apidoc": "^0.17.6",
"apidoc-markdown": "^0.2.0",
"babel-eslint": "^8.0.1",
"babel-jest": "^20.0.3",
"cross-env": "^5.0.5",
"dotenv-safe": "^4.0.3",
"eslint": "^4.4.1",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-promise": "^3.0.0",
"eslint-plugin-standard": "^3.0.1",
"jest-cli": "^20.0.4",
"mockgoose": "^6.0.8",
"nock": "^9.0.2",
"nodemon": "^1.10.2",
"opn-cli": "^3.1.0",
"sinon": "^4.0.1",
"supertest": "^3.0.0"
},
"dependencies": {
"adept-him-models": "git+ssh://git@github.com/AdeptMind/adept-him-models.git",
"async": "^2.6.0",
"babel-core": "^6.26.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-1": "^6.24.1",
"babel-runtime": "^6.26.0",
"bluebird": "^3.5.1",
"body-parser": "^1.18.2",
"bodymen": "^1.0.3",
"compression": "^1.7.1",
"cors": "^2.8.4",
"express": "^4.16.2",
"mongoose": "^5.0.11",
"mongoose-create-unique": "^0.4.4",
"mongoose-keywords": "^0.3.2",
"morgan": "^1.7.0",
"node-random-name": "^1.0.1",
"querymen": "^2.1.3",
"random-uri": "^1.0.3",
"request": "^2.83.0",
"request-promise": "^4.2.2"
}
我的.babelrc
:
{
"presets": [
"es2015",
"stage-1"
],
"plugins": [
"transform-runtime"
]
}