ERROR Invalid options in vue.config.js: "baseUrl" is not allowed

Vue 下創建 vue.config.js時,

module.exports = {
    baseUrl: process.env.NODE_ENV === 'production' ? './' : '/', //根路徑
    outputDir: 'dist', //構建輸出目錄
};

會拋以下錯誤:ERROR  Invalid options in vue.config.js: "baseUrl" is not allowed

PS E:\PHPCMS\htdocs\www.aerchi.com\vue\demo-cli4> npm run build

> [email protected] build E:\PHPCMS\htdocs\www.aerchi.com\vue\demo-cli4

 ERROR  Invalid options in vue.config.js: "baseUrl" is not allowed
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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\Aerchi\AppData\Roaming\npm-cache\_logs\2020-03-09T04_59_30_160Z-debug.log

查詢才知, baseUrl 已經被廢除了。唉。。。換成了 publicPath .

於是,換成了

module.exports = {
    baseUrl: process.env.NODE_ENV === 'production' ? './' : '/', //根路徑
    outputDir: 'dist', //構建輸出目錄
};

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章