vue build错误异常的解决方法

在生成vue项目的时候,出现如下错误

ERROR in static/js/index.d66d806fcdd72b36147b.js from UglifyJs
Unexpected token: punc (() [src/components/Hello.vue:26,0][static/js/index.d66d806fcdd72b36147b.js:34,6]

ERROR in static/js/cell.89bb6f1195b769a2c949.js from UglifyJs
Unexpected token: punc (() [src/components/cell.vue:10,0][static/js/cell.89bb6f1195b769a2c949.js:19,6]

ERROR in [copy-webpack-plugin] unable to locate 'J:\Dev\Project\jyhlClient\multiple-vue-page\static' at 'J:\Dev\Project\jyhlClient\multiple-vue-page\static'

解决方案:

1.在工程目录下新建.babelrc文件,注意文件类型选择File就可以了

vue build错误异常的解决方法_第1张图片

 

2.复制如下内容

{
    "presets": [
  
      ["env", {
        "modules": false,
        "targets": {
          "browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
        }
      }],
      "stage-2"
    ],
    "plugins": ["transform-runtime"],
    "env": {
  
      "test": {
        "presets": ["env", "stage-2"],
        "plugins": ["istanbul"]
      }
    }
  }

vue build错误异常的解决方法_第2张图片

 

 3.npm run build 就可以了

转载于:https://www.cnblogs.com/innershare/p/10746834.html

你可能感兴趣的:(vue build错误异常的解决方法)