I have just cloned the latest vitesse-webext project and added the following code, which is sending message correctly.
// src/options/Options.vue
<script setup lang="ts">
import { sendMessage, onMessage } from 'webext-bridge'
import { storageDemo } from '~/logic/storage'
const logIt = async() => {
console.log('hello there')
const dd = await sendMessage('get-current-tab', {}, 'background')
console.log(dd)
}
</script>
It logged both console messages when Log it button is clicked.
I need to sendMessage from some custom page, so I did the following:
// scripts/prepare.ts
const views = [
'options',
'popup',
'background',
'test',
]
Why its not sending message from the custom page, should I need some specific settings?
the complete code can be found at https://stackblitz.com/edit/vitejs-vite-ngk771?file=src%2Ftest%2FOptions.vue&terminal=dev