vbenjs / vite-plugin-html

A vite plugin for processing html. It is developed based on lodash template
MIT License
601 stars 96 forks source link

vite5警告:使用了废弃语法 #141

Closed peerless-hero closed 10 months ago

peerless-hero commented 10 months ago

vite具体版本:5.0.11 vite打包警告:

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

 WARN  plugin 'vite:html' uses deprecated 'enforce' option. Use 'order' option instead.                                                                            

 WARN  plugin 'vite:html' uses deprecated 'transform' option. Use 'handler' option instead.    

希望尽快适配以消除警告。

cctvhe11 commented 10 months ago

升级 3.2.1,使用 viteNext: true配置,可以消除

Ace627 commented 10 months ago
createHtmlPlugin({
  // 启用 Vite 最新语法模式
  viteNext: true,
  // 在这里写 entry 后,你将不需要在 `index.html` 内添加 script 标签,原有标签需要删除
  entry: 'src/main.ts',
  // 是否压缩 html
  minify: true,
  // 需要注入 index.html ejs 模版的数据
  inject: {
    data: { title: '动态标题', buildTime: new Date().toLocaleString() },
  },
})
qeleb commented 10 months ago

@peerless-hero The issue you are describing still exists in the latest release 3.2.1, but it was already fixed & merged to the main branch a few days ago. A release is on the way in the coming days.

@cctvhe11 @Ace627, the viteNext property has been removed, so when the next release is out, you may remove it from your configuration

EDIT: release 3.2.2 is out

Ace627 commented 10 months ago

@qeleb Ok,I got it,thank you。

peerless-hero commented 10 months ago

@qeleb 感谢你的及时跟进。 Thank you for your timely follow-up.