其他分享
首页 > 其他分享> > Vue项目配置CDN

Vue项目配置CDN

作者:互联网

两篇博客的实现方法不同。

另外:nginx的前端文件路径应该为:/usr/local/nginx/html下。

index.html

<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="<%= BASE_URL %>favicon.ico" />
  <title>
    <%= htmlWebpackPlugin.options.title %>
  </title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css" />
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.js"></script>   //在这里添加
  <script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.js"></script>
  <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.1.2/echarts.js"></script>

</head>

vue.config.js

module.exports = {
...
  configureWebpack: {

     ...
      externals: {
        'vue': 'Vue',
        'axios': 'axios',
        'echarts': 'echarts',
      }
    }
  ...
}

参考:https://blog.csdn.net/liubangbo/article/details/111039689

参考:https://www.jianshu.com/p/df980124841a

标签:...,Vue,CDN,配置,html,https,echarts,axios
来源: https://www.cnblogs.com/m1pha/p/16285331.html