import{ defineConfig,Plugin}from'vite'importvuefrom'@vitejs/plugin-vue'import{ createHtmlPlugin }from'vite-plugin-html'exportdefaultdefineConfig({plugins: [vue(),createHtmlPlugin({minify:true,/** * 在这里写entry后,你将不需要在`index.html`内添加 script 标签,原有标签需要删除 *@defaultsrc/main...
{ entry: 'src/other-main.ts', filename: 'other.html', template: 'public/other.html', injectOptions: { data: { title: 'other page', injectScript: `<script src="./inject.js"></script>`, }, tags: [ { injectTo: 'body-prepend', tag: 'div', attrs: { id: 'tag2', }, },...
<script src="//cdn.haier.net/assets/overlay/dts-fe/common-assets/@babel/polyfill/7.21.1/polyfill.min.js"></script> <!--前端框架调试版本--> <script src="//cdn.haier.net/assets/overlay/dts-fe/common-assets/react/16.13.1/react.development.js"></script> <script src="//cdn.haier.net/...
在上面的示例中,title 变量和 injectScript 标签将会被动态注入到 HTML 文件中。
* After writing entry here, you will not need to add script tags in `index.html`, the original tags need to be deleted * @default src/main.ts */entry:'src/main.ts',/** * If you want to store `index.html` in the specified folder, you can modify it, otherwise no configuration ...
UNPKG vite-plugin-htmlx/dist/index.d.ts Version: 969 BTypeScriptView Raw 1import{ HtmlTagDescriptor, Plugin }from'vite'; 2import{ Options }from'ejs'; 3import{ OptionsasOptions$1}from'html-minifier-terser'; 4 5interfaceInjectOptions { ...
injectScript:<script src="./inject.js"></script>, }, }, }), ], }) 基础配置表说明 |参数名|类型|默认值|描述| |---|---|---|---| |entry|string|src/main.ts|入口文件路径| |template|string|index.html|index.html模板路劲|
import{defineConfig}from'vite'importhtmlfrom'vite-plugin-htmlx'exportdefaultdefineConfig({plugins:[html({minify:true,page:{/*** Once you write the entry here, you will not need to add a script tag inside `index.html`,* and the original tag needs to be deleted.*/entry:'src/main.ts',...
vue3 父组件给子组件传递泛型(不用JSX) 引用和评论 被1篇内容引用 SegmentFault 思否技术周刊 Vol.65 — Vite 是不是在重复造轮子? 1 1条评论 得票最新 评论支持部分 Markdown 语法:**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用。你还可以使用@来通知其他用户。
import{defineConfig}from'vite';importsimpleHtmlPluginfrom'vite-plugin-simple-html';exportdefaultdefineConfig({plugins:[simpleHtmlPlugin({inject:{data:{title:'My app',script:'<script src="index.js"></script>',},tags:[{tag:'meta',attrs:{name:'description',content:'My awesome app',},},],...