Comments (10)
After removing this check, everything works fine.
from vue-cli-plugin-browser-extension.
I opened a PR suggesting this change
#64
from vue-cli-plugin-browser-extension.
I've tried to use v0.19.0 with the same setup and everything works fine! 🤔
from vue-cli-plugin-browser-extension.
Can you share you vue.config.js
file and your src/manifest.json
? Also how are you trying to invoke your content scripts and background scripts?
from vue-cli-plugin-browser-extension.
I found out the problem is not in the code please discard this PR.
the plugin even you are selecting content-script in options, it doesn't add on src/manifest.json
and only vue.config.js
is right
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["js/content-script.js"]
}
],
from vue-cli-plugin-browser-extension.
Correct. The snippet you added automatically injects a content script into every page. It is my opinion that this behavior should not be the default scaffolding behavior of browser extensions, as most developers will probably never circle back and change this to a narrower list if they didn't need it in the first place.
That being said, if this continues to be a pain point, then this means there is a difference in expectations of this plugin between myself and the community, or a lapse in documentation around this particular feature. Probably a good first step is to highlight this fact in the readme and see if there continues to be issues around expecting automatically injected content scripts on every page.
from vue-cli-plugin-browser-extension.
@adambullmer I believe the misunderstood is happen because when you are creating your first extension there are some options you can choose and when you select "content-script" between them we were expecting no need to setup more things to run it.
sorry for that.
One thing I would like to say is your work is amazing it is helping a lot.
from vue-cli-plugin-browser-extension.
Hello @adambullmer, I'm having a similar issue where my background.js code is not running. I have the default content (generated by your extension) in there, so I was expecting the content script to log a message in the web page console, and the background script to log a message to the background console. Neither of these is happening.
Looking at the conversation above, it seems like I need to add some config to get it working, but I don't have enough experience to know what to add or where to add it.
Can you clarify the steps required to get background and content scripts working with the out-of-the-box template?
from vue-cli-plugin-browser-extension.
I think I finally stumbled on the root cause of content scripts and background scripts not executing, and should be released in 0.23.1
. It looks like vue added in some optimizations in development mode, but only if your project were using a more recent version of vue-cli-service, and would explain why this was a little harder to track down.
@JasonLearmouth concerning your troubles, I think there is a bug in the scaffolding where the incorrect listener is being applied on the background file when also scaffolding with a popup (the default 2 options). This should be fixed in 0.23.2
. Depending on how much work you've put into your project I may recommend just rescaffolding with vue invoke browser-extension
once you've updated to the latest version. Otherwise, you can replace the top line of your backgound.js file with this:
browser.runtime.onMessage.addListener(function (request, sender, sendResponse) {
from vue-cli-plugin-browser-extension.
First time building an extension as well and trying to figure out why the default background.js doesn't execute. I read through the thread here, but still not really sure why it's not working 🤔 Any help would be appreciated
from vue-cli-plugin-browser-extension.
Related Issues (20)
- Conflict with `webextension-polyfill-ts` HOT 1
- add support for Manifest v3 HOT 39
- How to load css from tailwind inside shadowRoot ? HOT 3
- Cannot read property 'getCurrent' of undefined" HOT 1
- Bundled production-ready CSS filename in manifest.json HOT 9
- Output background.js in /dist/background.js HOT 3
- Does it support Vue3? HOT 1
- Doesn't work with code splitting (file.split is not a function) HOT 5
- browser.extension null HOT 7
- Source Map Errors HOT 1
- Webpack 5 support? HOT 5
- HMR for popup
- Allow for non-string objects in the `content_security_policy` field. HOT 4
- Sorry but what's standalone mean HOT 1
- Remove browser polyfill not work HOT 1
- TypeError: Cannot read properties of undefined (reading 'ignore') HOT 9
- Is this project dead? HOT 10
- manifest.json not copying correctly HOT 2
- MV3 live reload not working on chrome-extension://jxxxxxxxxxxxxxxxxxxxk/popup.html
- Advanced Extension Reloader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-cli-plugin-browser-extension.