一旦我尝试使用Promises,Browserify就会引发此错误。
在
中找不到模块'regenerator-runtime / runtime'我尝试了节点版本10.15.3和12.0.0。
为什么要在源文件夹而不是node_modules中寻找它?
这是我的babel.config.js
module.exports = function (api) {
api.cache(true);
const presets = [
["@babel/preset-env", {
"useBuiltIns": "usage",
"corejs": "2.6.5"
}
]];
const plugins = [];
return {
presets,
plugins
};
}
package.json
{
"name": "ehrsWAR",
"version": "1.10.15",
"private": true,
"scripts": {},
"browserslist": [
"> 5%",
"last 2 versions",
"Firefox > 20",
"ie >= 9"
],
"devDependencies": {
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/register": "^7.4.0",
"babelify": "^10.0.0",
"browserify": "^16.2.3",
"gulp": "^4.0.0",
"gulp-rename": "^1.4.0",
"gulp-streamify": "^1.0.2",
"gulp-uglify": "^3.0.2",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"watchify": "^3.11.1"
},
"browserify": {
"transform": [
"babelify"
]
},
"dependencies": {
"core-js": "^2.6.5"
}
}
答案 0 :(得分:0)
尝试在babel配置下的插件中包含“ @ babel / transform-runtime”。并在package.json中包含@ babel / plugin-transform-runtime。我遇到了同样的错误,这为我解决了这个问题。