Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

vue库模式打包为什么会自动生成html文件

build完以后,除了会生成js文件,还多出来对应的html文件。我看网上别人的好像没有html文件,这个怎么去掉

image.png

<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Vue App</title><link href="h-img.js" rel="preload" as="script"></head><body><div id="app"></div><script src="h-img.js"></script></body></html>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

搞死了,vue-cli自动加了preload、prefetch、htmlwebpack之类的插件,要把这些插件移除掉,因为配了多入口,所以要遍历移除

`

Object.keys(Components).forEach(entryName => {
  config.plugins.delete(`prefetch-${entryName}`)
  config.plugins.delete(`preload-${entryName}`)
  config.plugins.delete(`html-${entryName}`)
})

`


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...