html标签里面:

  <% if (process.env.NODE_ENV === 'development') { %>
  <script src="<%= BASE_URL %>libs/vue/vue.js"></script>
  <script src="<%= BASE_URL %>libs/vue-router/vue-router.js"></script>
  <script src="<%= BASE_URL %>libs/vuex/vuex.js"></script>
  <% } else { %>
  <script src="<%= BASE_URL %>libs/vue/vue.min.js"></script>
  <script src="<%= BASE_URL %>libs/vue-router/vue-router.min.js"></script>
  <script src="<%= BASE_URL %>libs/vuex/vuex.min.js"></script>
  <% }
  %>

javascript里面:

<script>

    if ('<%= process.env.NODE_ENV %>' === 'development') {
      window.SITE_CONFIG['apiURL'] = '/api';     //  prod_api                        // api请求地址
    }
    else {
      window.SITE_CONFIG['apiURL'] = '/prod_api';     //          
    }
</script>

访问打包后的文件文件路径:

  <script src="<%= BASE_URL %>iconfont/iconfont.js"></script>

 

Logo

前往低代码交流专区

更多推荐