ant 引入cdn 和解决首页访问出现很多预加载文件的问题

vue.config.js

module.exports = {
  // 解决首页访问出现很多预加载文件的问题
  chainWebpack: config => {
    // 移除 prefetch 插件
    config.plugins.delete('prefetch')
 
    // 或者
    // 修改它的选项:
    // config.plugin('prefetch').tap(options => {
    //   options[0].fileBlacklist = options[0].fileBlacklist || []
    //   options[0].fileBlacklist.push(/myasyncRoute(.)+?\.js$/)
    //   return options
    // })
  },

  // transpileDependencies: ['/@yabby-business/'],
  lintOnSave: false,

configureWebpack:{
  externals: {  
    vue: 'Vue',
    'moment': 'moment',
    'ant-design-vue': "antd"

  },
  resolve:{
    alias:{
      'assets':'@/assets',
      'common':'@/common',
      'components':'@/components',
      'network':'@/network',
      'views':'@/views',
    }
  }
},
devServer: {
  port: 11911
  },
  // runtimeCompiler: true,

  
}

 index.html

<!DOCTYPE html>
<html lang="en">

<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">
  <link rel="icon" href="https://online-education.codemao.cn/crm/2/customer/favicon.ico">
  <title>测试平台</title>

<!-- cdn引入组件库 -->
<!-- ant -->
<!-- <link rel="stylesheet" href="https://unpkg.com/material-design-icons-iconfont@6.5.0/dist/material-design-icons.css"> -->


  <!-- 滑动条样式  -->
  <style type="text/css">
    body {
      margin: 0;
    }
    ::-webkit-scrollbar {
      /*滚动条整体样式*/
      width: 10px;
    }
    ::-webkit-scrollbar-thumb {
      /*滚动条里面小方块*/
      -webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
      background: #e2e2e1;
      border-radius: 10px;
      height: 10px;
    }
    ::-webkit-scrollbar-track {
      /*滚动条里面轨道*/
      -webkit-box-shadow: inset 0 0 5px rgba(238, 238, 238, 0.2);
      background: #EDEDED;
    }
  </style>
</head>

<body>
  <noscript>
    <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
        Please enable it to continue.</strong>
  </noscript>
  <div id="app"></div>
  <!-- built files will be auto injected -->
  <!-- Vue.js CDN -->
  <script src="https://unpkg.com/vue@2.7.10/dist/vue.min.js"></script>
  <!-- ant -->
  <script src="https://cdn.jsdelivr.net/npm/moment@2.27.0/moment.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/ant-design-vue@1.6.4/dist/antd.min.js"></script>
</body>

</html>

 

https://www.cnblogs.com/clors/p/13267684.html

posted @ 2024-02-17 02:00  凯宾斯基  阅读(139)  评论(0编辑  收藏  举报