Flow_of_time 2021-04-21 16:34 采纳率: 0%
浏览 890

vue cli3 构建多页面应用 splitChunks拆分后启动项目页面没渲染出来。

vue cli3  构建多页面应用  splitChunks拆分后启动项目页面没渲染出来。有一个这样的警告(The resource http://xx.xx.xx.xx:xxxx/js/chunk-element-ui.js was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.),求问题解决办法及原因。

  • 写回答

4条回答 默认 最新

  • Chienlii 2023-05-31 16:20
    关注

    给多分页应用的每一个分页都添加 chunks ,并且每个chunks必须包含前三个 chunks:[分页名,'chunk-vendors','chunk-common']
    如下例子:(特别是chunk-common 一定要加)

    const sameChunks = [
      'chunk-vendors',
      'chunk-common',
      'chunk-ui',
      'chunk-pdfjs',
      'chunk-lodash',
      'chunk-moment',
      'chunk-html2canvas',
      'chunk-jspdf',
    ]
    let PAGES = {
      index: {
        // page的入口
        entry: 'src/benchs/index/main.js',
        // 模板来源
        template: 'public/index.html',
        // 在dist/index.html的输出
        filename: 'index.html',
        // 当使用title选项时
        // template中的title标签需要<title><%= htmlWebpackPlugin.options.title %></title>
        title: 'xx信息化平台',
        // 在这个页面中包含的块,默认情况下会包含
        // 提取出来的通用 chunk 和 vendor chunk
        chunks: ['index', ...sameChunks],
      },
    
    
    评论

报告相同问题?

悬赏问题

  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据