我正在尝试将git repo安装到项目中,以便可以导入组件。我不能使用npm打包组件,因为我们没有私有的npm注册表。
当我尝试安装时,出现“当前未启用对实验语法'jsx'的支持”。我在这里尝试了所有解决方案:Support for the experimental syntax 'classProperties' isn't currently enabled,但是它们没有用。 这是我的.babelrc:
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"plugins": [
[
"@babel/plugin-proposal-class-properties"
]
]
}
还有package.json:
"name": "i-react",
"version": "1.0.0",
"main": "build/index.js",
"repository": "ssh://......,
"author": "",
"license": "MIT",
"scripts": {
"build": "babel src -d build",
"prepare": "yarn run build"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.4",
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/plugin-syntax-jsx": "^7.10.4",
"@babel/preset-env": "^7.11.0",
"@babel/preset-react": "^7.10.4"
},
"dependencies": {
"react": "^16.13.1"
}
}