refactor: move HTML files to src/, use vite HTML entry points

- Move welcome.html to src/
- Use vite HTML inputs instead of static copy for offscreen.html and welcome.html
- Source HTML references .ts, vite transforms to .js
- Update paths in background.ts to src/
This commit is contained in:
Tommy D. Rossi
2026-01-23 17:19:14 +01:00
parent c9768965b5
commit b52928cc90
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -23,7 +23,7 @@ async function ensureOffscreenDocument(): Promise<void> {
// Check if already exists
const existingContexts = await chrome.runtime.getContexts({
contextTypes: [chrome.runtime.ContextType.OFFSCREEN_DOCUMENT],
documentUrls: [chrome.runtime.getURL('offscreen.html')],
documentUrls: [chrome.runtime.getURL('src/offscreen.html')],
})
if (existingContexts.length > 0) {
@@ -36,7 +36,7 @@ async function ensureOffscreenDocument(): Promise<void> {
}
offscreenDocumentCreating = chrome.offscreen.createDocument({
url: 'offscreen.html',
url: 'src/offscreen.html',
reasons: [chrome.offscreen.Reason.USER_MEDIA],
justification: 'Screen recording via chrome.tabCapture',
})
+1 -1
View File
@@ -4,6 +4,6 @@
<title>Playwriter Offscreen</title>
</head>
<body>
<script src="./offscreen.js" type="module"></script>
<script src="./offscreen.ts" type="module"></script>
</body>
</html>
+1 -1
View File
@@ -54,8 +54,8 @@ export default defineConfig({
rollupOptions: {
input: {
background: resolve(__dirname, 'src/background.ts'),
welcome: resolve(__dirname, 'src/welcome.html'),
offscreen: resolve(__dirname, 'src/offscreen.html'),
welcome: resolve(__dirname, 'src/welcome.html'),
},
output: {
entryFileNames: (chunkInfo) => {