额外的 HTML 页面
如果你需要声明超出 manifest 可容纳范围的额外 HTML 页面,请在 Vite 配置的 build.rollupOptions.input 中添加它们。
下面的示例包含一个欢迎页面,会在用户安装扩展时打开。
ts
# vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
input: {
welcome: './src/scopes/newpage/index.html',
},
},
},
})
# vite.config.ts
export default defineConfig({
build: {
rollupOptions: {
input: {
welcome: './src/scopes/newpage/index.html',
},
},
},
})
在开发环境中,Vite 会为这些输入页面提供服务;在生产构建中,会将它们的优化版本一起打包输出。