Vue-cli: 构建后public内子目录里的所有index.html文件丢失

Created on 10 Aug 2018  ·  3Comments  ·  Source: vuejs/vue-cli

Version

3.0.0-rc.12

Node and OS info

v8

Steps to reproduce

在public下创建相关文件结构如下:

/public
   /aa
     index.html
     index2.html
  /bb
     index.html
     index2.html
  ...

执行 npm run build 构建

What is expected?

期望相关文件正常保留。

What is actually happening?

在构建后的aa,bb目录下的index.html文件全部丢失。


发现这个问题造成的原因是:https://github.com/vuejs/vue-cli/blob/dev/packages/%40vue/cli-service/lib/config/app.js#L150
默认不会复制index.html。这个的默认值是一个固定值,期望可以配置或则保留index.html。

Most helpful comment

@yyx990803 这个场景不是多页面,就是static下有需要纯静态展示的资源,无需打包。

All 3 comments

多页面配置用 https://cli.vuejs.org/zh/config/#pages
不要用静态的 HTML.

@yyx990803 这个场景不是多页面,就是static下有需要纯静态展示的资源,无需打包。

找到解决方式了 #2174

chainWebpack: config => {
    config.plugin('copy')
        .tap(args => {
          //修改对应配置即可...
Was this page helpful?
0 / 5 - 0 ratings