Skip to content

Commit

Permalink
refactor: ♻️ remove superfluous
Browse files Browse the repository at this point in the history
  • Loading branch information
isaurssaurav committed Sep 29, 2023
1 parent 70521d9 commit c0e1691
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions src/scripts/background-reload.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { HOT_RELOAD_EXTENSION_VITE_PORT, Message, isDev } from '../utils';
import { HOT_RELOAD_EXTENSION_VITE_PORT, Message } from '../utils';
/**
* If development, this code will be appended to background script file.
*/
if (isDev) {
const socket = new WebSocket(`ws://localhost:${HOT_RELOAD_EXTENSION_VITE_PORT}`);
const socket = new WebSocket(`ws://localhost:${HOT_RELOAD_EXTENSION_VITE_PORT}`);

socket.addEventListener('message', (event) => {
if (event.data === Message.FILE_CHANGE) {
chrome.runtime.reload();
chrome.tabs.reload();
}
});
}
socket.addEventListener('message', (event) => {
if (event.data === Message.FILE_CHANGE) {
chrome.runtime.reload();
chrome.tabs.reload();
}
});
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig } from 'tsup';

export default defineConfig({
entry: ['src/main.ts', 'src/scripts/content-reload.ts', 'src/scripts/background-reload.ts'],
entry: ['src/main.ts', 'src/scripts/background-reload.ts'],
dts: true,
splitting: false,
sourcemap: false,
Expand Down

0 comments on commit c0e1691

Please sign in to comment.