日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

关于vue打包的问题

發布時間:2023/12/2 vue 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 关于vue打包的问题 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、vue-cli2
二、vue-cli3

一、vue-cli2

  • 錯誤提示:
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! hewelry@1.0.0 build: node build/build.js
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the hewelry@1.0.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\techsun\AppData\Roaming\npm-cache\_logs\2019-09-20T06_38_09_597Z-debug.log
  • 完整錯誤信息:




    因為這個提示,找了一整天,結果是因為 標簽沒有閉合!!!,簡直巨坑。

    2. 關于圖片資源路徑
    (1)現將 route.js 中的 mode:history 改成 mode:hash

    (2) config 文件夾下的 index.js

    3. 改了 assetsPublicPath 還是加載不出來,或者 index.html 不顯示, 仍然報:Failed to load resource: net::ERR_FILE_NOT_FOUND。找到 build 文件夾
    參考了這位老哥的分享:huang_jin_yi
    (1)webpack.base.conf.js 文件
    (2)webpack.prod.conf.js 文件添加:publicPath:'./

    4. 圖片路徑正確,但是背景圖沒有
    參考了這位老哥的分享:小嘜的前端寶庫
    build文件夾下 utils.js 文件下添加:publicPath:"../../"


    一、vue-cli3

    1. router.js 文件–>將 history 模式改成 hash 模式

    const router = new VueRouter({// mode: 'history',mode: 'hash',base: process.env.BASE_URL,//根routes })

    2. 在項目根目錄下 新增一個 vue.config.js 文件

    module.exports = {publicPath : './',//打包時配置靜態資源路徑 打包要“./”// publicPath: '/tcEnterprise'// vue-cli3中baseUrl被廢棄,用publicPathoutputDir: 'tcTrace' // 打包后壓縮包的名稱 }

    3. npm run build

    總結

    以上是生活随笔為你收集整理的关于vue打包的问题的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。