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

injectScript is not defined #126

Open farmercz opened 1 year ago

farmercz commented 1 year ago

版本: "vite": "4.3.9", "@types/node": "20.3.1", "@types/react": "18.2.8", "@types/react-dom": "18.2.4", "vite-plugin-html": "^3.2.0"

vite.config.ts配置: plugins: [ react(), createHtmlPlugin({ entry: 'src/main.tsx', inject:{ data:{ injectScript:<script src="./inject.js"></script> }, tags: [ { injectTo: 'body-prepend', tag: 'div', attrs: { id: 'tag', }, }, ], } }), ], index.html中使用: <%- injectScript %>

本地dev时出现错误: <!DOCTYPE html>

Error
zhnoah commented 1 year ago

injectScript: ''