GithubHelp home page GithubHelp logo

Comments (6)

yaoyao1987 avatar yaoyao1987 commented on September 26, 2024

@ediaos ,已修改// 配置生成的html文件,定义路径等 var conf = { // filename: pathname + '.html', filename: pathname + '.html', template: pages[pathname], // 模板路径 chunks: [pathname], // 每个html引用的js模块 inject: true // js插入位置 };,即新增一个chunks: [pathname]

from vue-cli-multipage.

ediaos avatar ediaos commented on September 26, 2024

@yaoyao1987
我测试了一下,build出来的html不引用 vendor和manifest 两js

from vue-cli-multipage.

ediaos avatar ediaos commented on September 26, 2024

目测全打包到了对应页面的js里

from vue-cli-multipage.

ediaos avatar ediaos commented on September 26, 2024

其他地方看到的解决方案:

  // 配置生成的html文件,定义路径等
  var conf = {
    filename: page + '.html',
    template: pages[page], //模板路径
    inject: true,
    // excludeChunks 允许跳过某些chunks, 而chunks告诉插件要引用entry里面的哪几个入口
    // 如何更好的理解这块呢?举个例子:比如本demo中包含两个模块(index和about),最好的当然是各个模块引入自己所需的js,
    // 而不是每个页面都引入所有的js,你可以把下面这个excludeChunks去掉,然后npm run build,然后看编译出来的index.html和about.html就知道了
    // filter:将数据过滤,然后返回符合要求的数据,Object.keys是获取JSON对象中的每个key
    excludeChunks: Object.keys(pages).filter(item => {
      return (item != page)
    })
  }

GITHUB

from vue-cli-multipage.

yaoyao1987 avatar yaoyao1987 commented on September 26, 2024

将chunks: [pathname]改成chunks: [pathname, 'vendor', 'manifest']即可解决

from vue-cli-multipage.

radicalviva avatar radicalviva commented on September 26, 2024

@yaoyao1987 请问下 为什么生成的dist目录下 需要有 vendor.js manifest.js 这2者和我pathname.js又有什么区别呢

from vue-cli-multipage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.