-
Notifications
You must be signed in to change notification settings - Fork 347
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
How would this work for content scripts? #4
Comments
I hadn't thought about this. I'll search and propose some elegant way to do this with this boilerplate. |
Hi. I made some changes on the boilerplate. Now, all files will be written on the dist folder, but we still using the webpack dev server, hot reload and all these cool things. With this change, now you can make reference on your manifest to files on your build folder, so, if you want to create a content script called
and declare that this file shouldn't be hot reloaded because you won't get the connection with the webpack dev server socket in other domain. To do so, just declare on your
Tell me if it does the work. |
@samuelsimoes I'm working on something similar using this boilerplate as baseline, But if I wan't a contentscript to be excluded I'll do it in I don't know if |
@vire I got your point, my intention was keep the "util scripts" untouched. The objective is: I need to exclude some entries to the hot reload and I have two ways: The first is to put to the developer to declare on the webpack config file the webpack hot reloads entries points on each entry point that he wants hot reload, actually it's automatically done here https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate/blob/master/utils/webserver.js#L15-L16. The second is keep it automatic like it's today and use some sort of key on the webpack config to tells to webserver ignore some entries. I understand your misgiving about this non-standard key, but I thought that it's the most ergonomic way to do this and it helps the people that want to update the boilerplate since the people don't touch the utils folder. What do you think? |
I think it's okay with a comment, in the It's the best to keep things simple and explicit |
This approach doesn't seem to update the Ex: I'm seeing a Also, how would one get a CSS content script deployed correctly? ex:
If |
@myktra sorry for the late response, I think that I expressed myself badly on my comments above, but you must place in the If your webpack config is:
your manifest must be
About the CSS on a separate file, it is a personal choice, I created the boilerplate staying close to the webpack's defaults, where the default is the CSS through javascript. I made a test here and the injected javascript injecting style seems works, but you could extract the CSS in a separate file using this plugin https://github.com/webpack/extract-text-webpack-plugin |
Yep, that all makes sense, and just arrived at a similar conclusion yesterday after my own testing and meant to post here...thanks! |
@samuelsimoes I was reading through exactly this issue and was very eager to make the hot reloading of contentscript work as most of my work is in the contentscript. I found out about this https://github.com/xpl/crx-hotreload and it seems to work. I just need to drop that script as my backgroundjs and it indeed is hot reloading the content script. Do you forsee any problem with it? Hope it is useful for those needing it (like me) ! thanks. |
@howardya Can you give a step-by-step breakdown of exactly what you did in order to get the hot reload working with a content script? When I put it in as a This part is sort of unclear for me:
|
|
Based on samuelsimoes/chrome-extension-webpack-boilerplate, I enable webpack hot reload. content script is excluded in hot reloaded entry. See: - https://github.com/samuelsimoes/chrome-extension-webpack-boilerplate - samuelsimoes/chrome-extension-webpack-boilerplate#4 (comment)
Thank you for boilerplate! I'm currently working on a Chrome extension that needs content scripts. So far I have been able to get it working by proxying to iFrame. That's not ideal. How would you go about making content scripts work?
The text was updated successfully, but these errors were encountered: