从项目中删除 Babel?(反应,包裹)



我正在努力在我的React和Parceljs项目中正确配置Babel。现在,我要做的就是从我的项目中完全删除 babel,从头开始。我已经继续'npm remove'ed babel,并删除了我的node.modules和package.lock.json。

这是我目前的包.json。

"scripts": {
"dev": "parcel public/index.html",
"start": "parcel public/index.html",
"prod": "parcel build public/index.html"
},
"author": "Me",
"license": "ISC",
"dependencies": {
"parcel-bundler": "^1.12.3",
"react": "^16.9.0",
"react-dom": "^16.9.0"
}
}

但是,当再次运行"npm install"时,babel 文件会重新出现并出现在我的 package.lock.json 和node_modules中。

而且我仍然收到这些错误,这些错误仅在我开始安装@babel软件包后出现。

Error: Cannot find module '@babel/core'
...
×  Cannot read property 'length' of undefined
...

Parcel 一直保留一个缓存目录。删除它并重建解决了问题。

最新更新