我是一名有用的助手,可以为您翻译文本。
我正在使用async/await代码,并收到“regeneratorRuntime未定义错误”。我尝试了stackoverflow上的几个解决方案,但我无法使它们中的任何一个工作。这是我的配置:
webpack.config.js:
我正在使用async/await代码,并收到“regeneratorRuntime未定义错误”。我尝试了stackoverflow上的几个解决方案,但我无法使它们中的任何一个工作。这是我的配置:
webpack.config.js:
module.exports = {
entry: ['babel-polyfill', './client/libs/compileTemplate/entry.jsx', './client/libs/compileTemplate/loginEntry.jsx'],
output: {
path: '/dist',
publicPath: '/assets',
filename: '[name].js'
},
plugins: plugins,
externals: {},
module: {
loaders: require('./webpack.config.loaders')
},
...
webpack.config.loaders.js:
module.exports = [
{
test: /\.jsx$/,
loader: 'babel',
query: {
presets: ['es2015', 'stage-0', 'react'],
}
},
];
包文件package.json中:
"devDependencies": { "babel-core": "^6.7.5", "babel-loader": "^6.2.4", "babel-polyfill": "^6.26.0", "babel-preset-es2015": "6.16.0", "babel-preset-react": "6.16.0", "babel-preset-stage-0": "^6.24.1", "json-loader": "^0.5.4", "less-loader": "2.2.3" }
我也在entry.jsx文件的开头require("babel-core/register")。
请告诉我哪里出了问题。
async function..
改为const name = async function
,谢谢。 - Marcelo