npm run serve報錯


報錯信息為:
Error loading C:\xxx\xxx\xxx\vue.config.js:
ERROR ValidationError: Invalid options object. Ignore Plugin has been initialized using an options object that does not match the API schema.

  • options should be one of these:
    object { resourceRegExp, contextRegExp? } | object { checkResource }
    Details:
    • options misses the property 'resourceRegExp'. Should be:
      RegExp
      -> A RegExp to test the request against.
    • options misses the property 'checkResource'. Should be:
      function
      -> A filter function for resource and context.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! artemis-plus@2.5.130 serve: vue-cli-service serve

可以看出是vue.config.js文件里面出了問題,Ignore Plugin這個地方的寫法不對,之前是new webpack.IgnorePlugin(/^./locale/, /moment/) ,可以正常運行,刪掉node_modules重新安裝之后就報錯了,正確的寫法上面已經提示了:{ resourceRegExp, contextRegExp? } 這種,修改方式為:

vue.config.js

 plugins: [
      // Ignore all locale files of moment.js
      // new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
      new webpack.IgnorePlugin({
        resourceRegExp: /^\.\/locale$/,
        contextRegExp: /moment$/,
      })
    ],

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM