Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-cli5去掉了preload和prefetch吗? #6672

Closed
yangdan8 opened this issue Sep 6, 2021 · 2 comments
Closed

vue-cli5去掉了preload和prefetch吗? #6672

yangdan8 opened this issue Sep 6, 2021 · 2 comments

Comments

@yangdan8
Copy link

yangdan8 commented Sep 6, 2021

Version

5.0.0-beta.3

Reproduction link

github.com

Environment info

win10

Steps to reproduce

1.安装依赖npm i
2.执行打包npm build
3.查看dist

What is expected?

index.html中生成preload和prefetch

What is actually happening?

index.html中没有生成preload和prefetch

@freemansj
Copy link

As indicated in the Notes in the source code : (@vue/cli-service/lib/config/app.js:197)

image

@yangdan8
Copy link
Author

const { defineConfig } = require("@vue/cli-service");

const PreloadPlugin = require("@vue/preload-webpack-plugin");

module.exports = defineConfig({
  transpileDependencies: true,
  chainWebpack: (config) => {
    config.plugin("preload").use(PreloadPlugin, [
      {
        rel: "preload",
        include: "initial",
        fileBlacklist: [/.map$/, /hot-update.js$/],
      },
    ]);

    config.plugin("prefetch").use(PreloadPlugin, [
      {
        rel: "prefetch",
        include: "asyncChunks",
      },
    ]);

    console.log("config", config);
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants