node_modules中的babel箭头函数错误 [英] babel arrow functions error in node_modules
本文介绍了node_modules中的babel箭头函数错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我要构建时,出现以下错误(node_modules中的错误):
when i want build react the bellow error appear(error in node_modules):
ERROR in ./node_modules/react-native-video/Video.js 54:7
Module parse failed: Unexpected token (54:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| }
|
> seek = (time, tolerance = 100) => {
| if (isNaN(time)) throw new Error('Specified time is not a number');
我将这一部分添加到babel文件中
And i add this section to babel file
babel.config.js
babel.config.js
module.exports = {
presets: [
"@babel/preset-env",
'@babel/react',
"module:metro-react-native-babel-preset"
],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-arrow-functions"
]
}
和我的webpack
and my webpack
const HtmlWebPackPlugin = require("html-webpack-plugin");
module.exports = {
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
....
};
任何人都可以帮忙吗?
推荐答案
我的Webpack配置未设置为将node_modules文件传递给babel-loader删除 exclude:/node_modules/,
my Webpack config is not set up to pass node_modules files to babel-loader
remove exclude: /node_modules/,
这篇关于node_modules中的babel箭头函数错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文