Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix background HMR by @tyn1998 #110

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

octohedron
Copy link

@octohedron octohedron commented Apr 2, 2022

As per this comment #40 (comment) I extracted the fix for the HMR, and did some minor updates

  • Popup and Greetings are now tsx files
  • Added a button to the Popup with a counter as an example
  • Added an example for listening to tab changes in the background
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
  if (changeInfo.status == 'complete') {
    console.log('Tab finished loading', tabId, tab);
    // do your things
  }
});
  • Updated the webpack config and README

TODO: Add instructions as explained in #40 (comment)

@amehito
Copy link

amehito commented Apr 10, 2022

expecting for merger

@@ -21,6 +21,7 @@
"css": ["content.styles.css"]
}
],
"host_permissions": ["http://*/"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please explain why is this needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The host_permissions are required if you want to inject something in a matching page, download from a matching URL, or observe via webRequest and similar APIs.

Most extensions will need it, not all of course, I spent a considerable amount of time trying to figure out why things were not working and that was one of the issues.

Could be added to the readme or removed, as you wish, personally, for a boilerplate, I would add all the possible fields in there with default values so new developers know what they can use or could be the cause of an issue.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might make sense to have the fields you may want (as in my case, including host_permissions) commented out in the file, and in the uncommented code support the most basic and least permissive cases. It's an approach I've seen in other config files that would also work here, and also one that doesn't risk someone accidentally asking for permissions they don't need.

@moshOntong-IT
Copy link

it seems the package author is not active

@VecHK
Copy link

VecHK commented Jun 20, 2022

good job

notHotReload: ['background', 'contentScript', 'devtools'],
custom: {
notHMR: ['background', 'contentScript', 'devtools'],
enableBackgroundAutoReload: true, // always true when "enableContentScriptsAutoReload" is set true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to link somewhere in the documentation that explains this reasoning.

@joshsmith
Copy link

@lxieyang I know things come up (I've been there an OSS maintainer in the past). If you're not able to remain active, would you mind considering opening up shared responsibility to contributors who appear interested in helping to maintain the repo?

@@ -33,7 +33,7 @@ if (fileSystem.existsSync(secretsPath)) {
alias['secrets'] = secretsPath;
}

var options = {
let options = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick. This doesn't need to be a let. Setting it to const is fine, even though you're updating something within the object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants