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:
@@ -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',
|
||||
})
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user