vite-plugin-html icon indicating copy to clipboard operation
vite-plugin-html copied to clipboard

打包时候报警告 in "/index.html" can't be bundled without type="module" attribute

Open mediolop opened this issue 2 years ago • 10 comments

是否可以消除这个警告

mediolop avatar Jul 18 '22 01:07 mediolop

试了直接报错

lhf6623 avatar Dec 14 '22 10:12 lhf6623

image

lhf6623 avatar Dec 14 '22 11:12 lhf6623

我也遇到了这个问题,请问最后如何解决了呢

ghost avatar Dec 16 '22 03:12 ghost

首先设置 inject.tags.attrs.type = "module", 然后把 vite-plugin-html配置中的 inject.tags.attrs.src 添加到 vite.config.js 中的 build.rollupOptions.external 中

lhf6623 avatar Dec 16 '22 03:12 lhf6623

如果不是第三方包怎么external

sunchengfeng01 avatar Jul 19 '23 07:07 sunchengfeng01

@sunchengfeng01 哥们你解决了吗,我也遇到这个问题了

eveforest avatar Aug 04 '23 07:08 eveforest

+1

s3xysteak avatar Nov 08 '23 03:11 s3xysteak

@sunchengfeng01, @eveforest, @s3xysteak

Here what works for me:

vite.config.ts

build.rollupOptions.external: [/^(.*)_app.config.js(.*)/],

html.ts // vite-plugin-html

inject.tags.attrs.type = "module",

fcsbr avatar Jan 06 '24 13:01 fcsbr