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

来源:2-8 vue-cli 3.0搭建方法(脚手架创建项目)

糍粑鱼

2019-11-19

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

写回答

1回答

糍粑鱼

提问者

2019-11-19

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

要用publicPath 这真是一个坑

1
2
Z1659395
// const { defineConfig } = require('@vue/cli-service') const publicPath= process.env.NODE_ENV === 'production' ? './' : './' module.exports = { publicPath: publicPath // transpileDependencies: true } 这样就可以了
2022-09-03
共2条回复

Vue 实战商业级读书Web APP完整项目

Vue全家桶+最新前端技术+前后端分离架构,完整项目流程

1623 学习 · 1951 问题

查看课程