欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

npm run build 报错问题

程序员文章站 2022-05-30 09:19:49
...

ERROR in static/js/app.c75e3183ee8f2216d466.js from UglifyJs

Unexpected token: operator (>) [./unfetch/unfetch.js:14,0][static/js/app.c75e3183ee8f2216d466.js:901,41]

 

修改webpack的配置

{
    test: /\.js$/,
    loader: 'babel-loader',
    options: {
        presets: ['es2015']
    },
    include: [resolve('src'), resolve('test')]
}

将你报错的东西添加到里面去,如下

{
    test: /\.js$/,
    loader: 'babel-loader',
    options: {
        presets: ['es2015']
    },
    include: [resolve('src'), resolve('test'), resolve('unfetch')]
}