请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

为什么配置了vue.config.js之后 npm run build 报错了

ERROR Invalid options in vue.config.js: “baseUrl” is not allowed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-imooc-ebook@0.1.0 build: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-imooc-ebook@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-11-19T14_40_08_691Z-debug.log

正在回答 回答被采纳积分+3

1回答

提问者 糍粑鱼 2019-11-19 23:24:08

自己找到原因了  提示'baseUrl' is not allowed 

要用publicPath 这真是一个坑

1 回复 有任何疑惑可以回复我~
  • 还是不行呀
    回复 有任何疑惑可以回复我~ 2022-09-03 11:30:06
  • // const { defineConfig } = require('@vue/cli-service')
    const publicPath= process.env.NODE_ENV === 'production'
    ? './'
    : './'
    module.exports = {
      publicPath: publicPath
      // transpileDependencies: true
    }
    这样就可以了
    回复 有任何疑惑可以回复我~ 2022-09-03 13:11:49
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号