Replies: 3 comments 5 replies
-
Of course you can, but you need to use <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
</head>
<body>
<div id="app"></div>
<%- injectScript %>
</body>
</html> // vite.config.ts
import { createHtmlPlugin } from 'vite-plugin-html'
const main = '/packages/module1/main.ts' // Dynamic according to the actual situation
export default defineConfig({
plugins: [
createHtmlPlugin({
inject: {
data: {
injectScript: `<script type="module" src="${main}"></script>`,
},
},
}),
]
}) |
Beta Was this translation helpful? Give feedback.
-
This configuration only works in production mode. |
Beta Was this translation helpful? Give feedback.
-
Hi, have you resolve this issues cause I try to achieve the same; Cause I put |
Beta Was this translation helpful? Give feedback.
-
Hello, we are trying to replicate a vue-cli webpack configuration for multiple projects in a monorepo.
Given
and
but unfortunately there seems to be a problem...
What are our options to have a single index.html? (that would not require us to copy the same index.html over and over)
Beta Was this translation helpful? Give feedback.
All reactions