Skip to content

使用preload之后生成的html文件多出来静态资源的引入 #4474

Closed
@haojieguangxin

Description

@haojieguangxin

Version

3.8.0

Environment info

vue 2.0

Steps to reproduce

  1. 使用npm run build进行打包
  2. 观察生成的index.html文件

发现有重复的css被引入

<link href=/css/app.b4661067.css rel=preload as=style>
<link href=/css/app.b4661067.css rel=stylesheet>

What is expected?

有preload的文件,不要再重新引入一遍了

What is actually happening?

出现了两个同名的文件引入


这个是因为,在vue-cli-service中使用了html-webpack-plugin的时候已经有部分静态资源引入到了index.html,再执行@vue/preload-webpack-plugin的时候,又把html-webpack-plugin中处理过的静态资源又处理了一遍引入到了页面中。我怎么保留preload的那个标签,删除掉不带preload的标签

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions