vite-plugin-html
vite-plugin-html copied to clipboard
多页面模式下不同页面的template有办法用同一个html吗
try this.
createHtmlPlugin({ minify: hasBuild, entry:
src/views/${project[projectName].viewsPath}/main.js, template: 'index.html', inject: { data: { htmlData: { options: { appCode: project[projectName].appCode, mainJs:
./src/views/${project[projectName].viewsPath}/main.js, } } } } })
<script type="module" src="<%- htmlData.options.mainJs %>"></script>
try this.
createHtmlPlugin({ minify: hasBuild, entry:
src/views/${project[projectName].viewsPath}/main.js, template: 'index.html', inject: { data: { htmlData: { options: { appCode: project[projectName].appCode, mainJs:
./src/views/${project[projectName].viewsPath}/main.js, } } } } })
<script type="module" src="<%- htmlData.options.mainJs %>"></script>
感谢,但是这个方法我之前就试过行不通的,开发时无法进入第二个入口,打包后也只有一个html文件