-
Notifications
You must be signed in to change notification settings - Fork 8
docs: example of using experimental output on content script entry #56
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
base: master
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
@Jack-Works thanks! I managed to have it working with most of Extension.js templates but still need to support CSS modules / SASS + SASS modules in content_scripts. any hints to make it work? |
|
@cezaraugusto CSS is a tricky thing in content scripts. What I do is put all my DOM inside a ShadowRoot and use ShadowRoot.adoptedStyleSheets to apply my styles. By this way, my style will not affect webpages' style and vice versa. |
|
thanks! now I'm facing a weird issue. I just pushed a new version
|
|
fwiw I'm calling webpack-target-webextension using |
|
I managed to get it working by hardcoding the |
new WebExtension({
background: this.getEntryName(patchedManifest),
weakRuntimeCheck: true
}).apply(compiler)Can you try this? We support rspack directly, no need to "convert to webpack compiler". |
This comment was marked as outdated.
This comment was marked as outdated.
|
@cezaraugusto It's a rspack bug, see web-infra-dev/rspack#9898. downgrade to 1.3.1 solves the problem |
|
@Jack-Works that was it! thank you for investigating! |
If you're running content scripts in a "main" world, then it is no longer content scripts (in the sense this plugin supports). I think you cannot bundle main world scripts within the same webpack config, but I'm not sure. I use rollup to bundle main world scripts in our project. |


This PR is an example of using
experimental_outputto add HMR to the root file of the content script. This PR will not be merged since this feature is marked as "experimental".