Error using ES7 async/await with node, webpack and babel-loader

老子叫甜甜 提交于 2019-12-05 10:22:16

Your src path was incorrect. You should never (like never :)) join pathes using string concatenation there is path.join for that.

{
   test: /\.jsx?$/,
   include: path.join(__dirname, 'src'),
   loader: 'babel-loader'
}

BTW, this will fix parsing issue but you still gonna need to handle .json file loading by adding corresponding extension to resolve section and using json-loader

{ test: /\.json$/, loader: 'json-loader' }

Also you'll need to handle missing modules warning. For example fs and net.

So I do recommend you to use babel-cli to precompile server code.

babel src --out-dir dist
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!