当前位置:   article > 正文

Vue项目打包出现的常见问题_/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js' doe

/@dcloudio/uni-h5-vue/dist/vue.runtime.esm.js' does not provide an export na

1.index.html访问空白

config/index.js文件中修改配置assetsPublicPathassetsPublicPath: '/'改成assetsPublicPath: './'

  1. build: {
  2. // Template for index.html
  3. index: path.resolve(__dirname, '../dist/index.html'),
  4. // Paths
  5. assetsRoot: path.resolve(__dirname, '../dist'),
  6. assetsSubDirectory: 'static',
  7. assetsPublicPath: './', // 解决打包后,访问html,显示空白问题
  8. ******
  9. }

2.图片无法显示

找到build/utils.js,搜索use: loaders下面添加publicPath: '../../'

  1. // Extract CSS when that option is specified
  2. // (which is the case during production build)
  3. if (options.extract) {
  4. return ExtractTextPlugin.extract({
  5. use: loaders,
  6. publicPath: '../../', // 解决图片无法显示问题
  7. fallback: 'vue-style-loader'
  8. })
  9. } else {
  10. return ['vue-style-loader'].concat(loaders)
  11. }

3.样式丢失

main.js修改导入包的顺序,将路由包放到最后

  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from './store'
  4. import 'babel-polyfill'
  5. import apiBaseUrlConfig from './global/apiBaseUrlConfig'
  6. // 引入elementUI
  7. import ElementUI from 'element-ui'
  8. import utils from './global/utils'
  9. // 引入自写公共组件
  10. import '@/components/common'
  11. // 自定义icon
  12. import '@/assets/css/system_Setting/iconfont.css'
  13. import Axios from 'axios'
  14. import router from './router' // 解决样式丢失问题
  15. Vue.use(apiBaseUrlConfig)
  16. Vue.use(ElementUI)

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/258917
推荐阅读
相关标签
  

闽ICP备14008679号