Kocal / vue-web-extension

🛠️ A Vue CLI 3+ preset (previously a Vue CLI 2 boilerplate) for quickly starting a web extension with Vue, Babel, ESLint and more!
https://vue-web-extension.netlify.app/
MIT License
1.58k stars 167 forks source link

Uncaught (in promise) error in background page console when I click the browser action button. Content script is also not executing. #653

Closed grandslammer closed 3 years ago

grandslammer commented 3 years ago

Uncaught (in promise) error in background page console when I click the browser action button. Content script is also not executing. Fresh project, I literally just did:

vue create --preset kocal/vue-web-extension my-extension
cd my-extension
npm run build

installed the extension, clicked the extension button in Chrome, and checked the background console. I have retested several (created new projects) and it happens each time.

Screenshot_10

grandslammer commented 3 years ago

Solved it: In background.js, change line 5 from: file: "content-script.js",

to: file: "js/content-script.js",

The content script file path must be given from the extension root.

Kocal commented 3 years ago

Hi :wave:

I think your issue is caused by this https://github.com/adambullmer/vue-cli-plugin-browser-extension/blob/master/generator/template/background/src/background.js#L10

And it seems that there is already an issue for that, see https://github.com/adambullmer/vue-cli-plugin-browser-extension/issues/95.

Opening a PR by changing file: 'content-script.js', to file: 'js/content-script.js' would be enough... Thanks!

maxflex commented 3 years ago

Thanks a lot, that helped

brianberneker commented 3 years ago

I've changed the file:

file: "content-script.js", to: file: "js/content-script.js",

And now I still get the uncaught in promise error, but my "Hello from background" just keeps looping. Any help would be appreciated!

Screen Shot 2021-08-07 at 5 29 12 PM