最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

vue-next-admin項目使用cdn加速詳細配置

 更新時間:2023年06月09日 11:04:46   作者:張旭超  
這篇文章主要為大家介紹了vue-next-admin項目使用cdn加速的詳細配置,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪

首先開啟打包cdn加速

vue-next-admin是本身是配置好cdn加速的,只是沒有開啟。

根目錄找到.env文件,開啟打包cdn加速

找到utils、build.ts文件

默認是注釋了一些代碼的,這里需要注意的就是幾個變量。

prodUrl: https://unpkg.com/{name}@{version}/{path}

name: 依賴包的名稱

var: 包暴露的全局變量名稱

path: cdn unpkg鏈接地址

我們的modules里面的變量會替換掉name,version,path。

path要在unpkg網(wǎng)站查找對應(yīng)的地址,我下載vue-next-admin項目的時候有五個地址配置的有問題(打包以后運行就知道那些地址不對),我做了修改,然后打包就沒問題了。

最有一項,填寫了完整路徑的不做替換。

import importToCDN, { autoComplete } from 'vite-plugin-cdn-import';
/**
 * 打包相關(guān)
 * 注意 prodUrl:使用的是 jsdelivr 還是 unpkg。它們的 path 可能不一致
 * 文章鏈接:https://blog.csdn.net/qq_34450741/article/details/129766676,使用的是 jsdelivr
 * @description importToCDN https://github.com/mmf-fe/vite-plugin-cdn-import
 * @description cdn 在線引入的 cdn 地址配置。path:https://www.jsdelivr.com/ || https://unpkg.com/
 * @description external 打包時,過濾包導(dǎo)入。參考:https://rollupjs.org/configuration-options/#external
 */
// 這里使用unpkg
// https://unpkg.com/{name}@{version}/{path}
// name: 依賴包的名稱
// var:包暴露的全局變量名稱
// path cdn unpkg鏈接地址
export const buildConfig = {
    cdn() {
        return importToCDN({
            prodUrl: 'https://unpkg.com/{name}@{version}/{path}',
            modules: [
                autoComplete('vue'),
                autoComplete('axios'),
                {
                    name: 'vue',
                    var: 'Vue',
                    path: 'dist/vue.global.js',
                },
                {
                    name: 'vue-demi',
                    var: 'VueDemi',
                    path: 'lib/index.iife.js',
                },
                {
                    name: 'vue-router',
                    var: 'VueRouter',
                    path: 'dist/vue-router.global.js',
                },
                {
                    name: 'element-plus',
                    var: 'ElementPlus',
                    path: 'dist/index.full.js',
                },
                {
                    name: '@element-plus/icons-vue',
                    var: 'ElementPlusIconsVue',
                    path: 'dist/index.iife.min.js',
                },
                {
                    name: 'echarts',
                    var: 'echarts',
                    path: 'dist/echarts.min.js',
                },
                {
                    name: 'echarts-gl',
                    var: 'echarts-gl',
                    path: 'dist/echarts-gl.min.js',
                },
                {
                    name: 'echarts-wordcloud',
                    var: 'echarts-wordcloud',
                    path: 'dist/echarts-wordcloud.min.js',
                },
                {
                    name: 'vue-i18n',
                    var: 'VueI18n',
                    path: 'dist/vue-i18n.global.js',
                },
                {
                    name: 'jsplumb',
                    var: 'jsPlumb',
                    path: 'dist/js/jsplumb.min.js',
                },
                {
                    name: 'cropperjs',
                    var: 'Cropper',
                    path: 'dist/cropper.min.js',
                },
                {
                    name: 'sortablejs',
                    var: 'Sortable',
                    path: 'Sortable.min.js',
                },
                {
                    name: 'qrcodejs2-fixes',
                    var: 'QRCode',
                    path: 'qrcode.js',
                },
                {
                    name: 'print-js',
                    var: 'printJS',
                    path: 'dist/print.js',
                },
                {
                    name: '@wangeditor/editor',
                    var: 'wangEditor',
                    path: 'dist/index.js',
                },
                {
                    name: '@wangeditor/editor-for-vue',
                    var: 'WangEditorForVue',
                    path: 'dist/index.js',
                },
                {
                    name: 'vue-grid-layout',
                    var: 'VueGridLayout',
                    path: 'https://cdn.jsdelivr.net/npm/vue-grid-layout@3.0.0-beta1/dist/vue-grid-layout.umd.min.js',
                },
            ],
        });
    },
    external: [
        'vue',
        'axios',
        'vue-router',
        'element-plus',
        '@element-plus/icons-vue',
        'echarts',
        'echarts-gl',
        'echarts-wordcloud',
        'vue-i18n',
        'jsplumb',
        'cropperjs',
        'sortablejs',
        'qrcodejs2-fixes',
        'print-js',
        '@wangeditor/editor',
        '@wangeditor/editor-for-vue',
        'vue-grid-layout',
    ],
};

運行 npm run build打包

 打包厚的index.html文件

<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <meta
            name="keywords"
            content="vue-next-admin,vue-prev-admin,vue-admin-wonderful,后臺管理系統(tǒng)一站式平臺模板,希望可以幫你完成快速開發(fā)。vue2.x,vue2.0,vue2,vue3,vue3.x,vue3.0,CompositionAPI,typescript,element plus,element,plus,admin,wonderful,wonderful-next,vue-next-admin,vite,vite-admin,快速,高效,后臺模板,后臺系統(tǒng),管理系統(tǒng)"
        />
        <meta
            name="description"
            content="vue-next-admin,基于 vue3 + CompositionAPI + typescript + vite + element plus,適配手機、平板、pc 的后臺開源免費管理系統(tǒng)模板!vue-prev-admin,基于 vue2 +  element ui,適配手機、平板、pc 的后臺開源免費管理系統(tǒng)模板!"
        />
        <link rel="icon" href="./favicon.ico" rel="external nofollow"  />
        <title>vue-next-admin</title>
<script src="https://unpkg.com/vue@3.2.47/dist/vue.global.prod.js"></script>
<script src="https://unpkg.com/axios@1.3.5/dist/axios.min.js"></script>
<script src="https://unpkg.com/vue@3.2.47/dist/vue.global.js"></script>
<script src="https://unpkg.com/vue-demi@0.13.11/lib/index.iife.js"></script>
<script src="https://unpkg.com/vue-router@4.1.6/dist/vue-router.global.js"></script>
<script src="https://unpkg.com/element-plus@2.3.3/dist/index.full.js"></script>
<script src="https://unpkg.com/@element-plus/icons-vue@2.1.0/dist/index.iife.min.js"></script>
<script src="https://unpkg.com/echarts@5.4.2/dist/echarts.min.js"></script>
<script src="https://unpkg.com/echarts-gl@2.0.9/dist/echarts-gl.min.js"></script>
<script src="https://unpkg.com/echarts-wordcloud@2.1.0/dist/echarts-wordcloud.min.js"></script>
<script src="https://unpkg.com/vue-i18n@9.2.2/dist/vue-i18n.global.js"></script>
<script src="https://unpkg.com/jsplumb@2.15.6/dist/js/jsplumb.min.js"></script>
<script src="https://unpkg.com/cropperjs@1.5.13/dist/cropper.min.js"></script>
<script src="https://unpkg.com/sortablejs@1.15.0/Sortable.min.js"></script>
<script src="https://unpkg.com/qrcodejs2-fixes@0.0.2/qrcode.js"></script>
<script src="https://unpkg.com/print-js@1.6.0/dist/print.js"></script>
<script src="https://unpkg.com/@wangeditor/editor@5.1.23/dist/index.js"></script>
<script src="https://unpkg.com/@wangeditor/editor-for-vue@5.1.12/dist/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue-grid-layout@3.0.0-beta1/dist/vue-grid-layout.umd.min.js"></script>
        <script type="module" crossorigin src="./assets/js/index-3b8bf49e.js"></script>
        <link rel="modulepreload" crossorigin href="./assets/js/pinia-ce2dce77.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/js-cookie-cf83ad76.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/has-symbols-e8f3ca0e.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/function-bind-22e7ee79.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/has-26d28e02.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/get-intrinsic-b9397c9a.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/call-bind-1df9733d.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/nprogress-5ada7e0c.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/object-inspect-d11bccf2.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/side-channel-9112baf6.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/qs-a8db372b.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/element-plus-ef4dc42a.js" rel="external nofollow" >
        <link rel="modulepreload" crossorigin href="./assets/js/mitt-f7ef348c.js" rel="external nofollow" >
        <link rel="stylesheet" href="./assets/css/nprogress-8b89e2e0.css" rel="external nofollow" >
        <link rel="stylesheet" href="./assets/css/index-c2520709.css" rel="external nofollow" >
    </head>
    <body>
        <div id="app"></div>
        <script type="text/javascript">
            var _hmt = _hmt || [];
            (function () {
                var hm = document.createElement('script');
                hm.src = 'https://#/hm.js?d9c8b87d10717013641458b300c552e4';
                var s = document.getElementsByTagName('script')[0];
                s.parentNode.insertBefore(hm, s);
            })();
        </script>
        <script type="text/javascript" src="https://api.map.baidu.com/api?v=3.0&ak=wsijQt8sLXrCW71YesmispvYHitfG9gv&s=1"></script>
    </body>
</html>

以上就是vue-next-admin項目使用cdn加速詳細配置的詳細內(nèi)容,更多關(guān)于vue-next-admin cdn加速的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Vue無法訪問.env.development定義的變量值問題及解決

    Vue無法訪問.env.development定義的變量值問題及解決

    這篇文章主要介紹了Vue無法訪問.env.development定義的變量值問題及解決,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-01-01
  • 給vue項目添加ESLint的詳細步驟

    給vue項目添加ESLint的詳細步驟

    本篇文章主要介紹了給vue項目添加ESLint的詳細步驟,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-09-09
  • 記一次vue去除#問題處理經(jīng)過小結(jié)

    記一次vue去除#問題處理經(jīng)過小結(jié)

    這篇文章主要介紹了vue去除#問題處理經(jīng)過,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-01-01
  • ant design vue嵌套表格及表格內(nèi)部編輯的用法說明

    ant design vue嵌套表格及表格內(nèi)部編輯的用法說明

    這篇文章主要介紹了ant design vue嵌套表格及表格內(nèi)部編輯的用法說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-10-10
  • vue?axios?form-data格式傳輸數(shù)據(jù)和文件方式

    vue?axios?form-data格式傳輸數(shù)據(jù)和文件方式

    這篇文章主要介紹了vue?axios?form-data格式傳輸數(shù)據(jù)和文件方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2023-05-05
  • VUE項目中引入vue-router的詳細過程

    VUE項目中引入vue-router的詳細過程

    vue-router 也叫 vue 路由,根據(jù)不同的路徑,來執(zhí)行不同的組件,這篇文章主要介紹了VUE項目中引入vue-router,需要的朋友可以參考下
    2023-05-05
  • VS-Code中Vue3項目創(chuàng)建vite方式

    VS-Code中Vue3項目創(chuàng)建vite方式

    用戶詳細說明了使用Node.js和Vite創(chuàng)建Vue3項目的過程,包括安裝依賴、項目結(jié)構(gòu)解析(如src/main.ts、App.vue、components、assets等),以及VSCode插件配置建議,強調(diào)核心插件安裝和依賴管理的重要性
    2025-08-08
  • vue源碼學(xué)習(xí)之Object.defineProperty 對數(shù)組監(jiān)聽

    vue源碼學(xué)習(xí)之Object.defineProperty 對數(shù)組監(jiān)聽

    這篇文章主要介紹了vue源碼學(xué)習(xí)之Object.defineProperty 對數(shù)組監(jiān)聽,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-05-05
  • 一文搞明白vue開發(fā)者vite多環(huán)境配置

    一文搞明白vue開發(fā)者vite多環(huán)境配置

    Vue是一款流行的JavaScript框架,用于開發(fā)動態(tài)單頁應(yīng)用程序,本地安裝和環(huán)境配置是學(xué)習(xí)和使用Vue的第一步,下面這篇文章主要給大家介紹了關(guān)于vue開發(fā)者vite多環(huán)境配置的相關(guān)資料,需要的朋友可以參考下
    2023-06-06
  • vue項目中使用window的onresize事件方式

    vue項目中使用window的onresize事件方式

    這篇文章主要介紹了vue項目中使用window的onresize事件方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-08-08

最新評論

石门县| 延边| 靖远县| 海盐县| 宕昌县| 奉节县| 通海县| 凤凰县| 临漳县| 综艺| 蕉岭县| 吴桥县| 宿松县| 凤翔县| 石景山区| 永新县| 浙江省| 九台市| 武胜县| 永兴县| 龙里县| 江永县| 厦门市| 普宁市| 措美县| 丰宁| 修文县| 新密市| 柘城县| 合川市| 军事| 商河县| 瑞安市| 托里县| 会泽县| 图片| 红原县| 昔阳县| 九江县| 江安县| 同德县|