-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add --webextension option to command line #2
base: master
Are you sure you want to change the base?
Conversation
The --webextension option will automatically add webextension-polyfill to your extension by default.
As most of the users would want their extension to work cross-browser, I was thinking of keeping WebExtension as a built-in support and not enable it through an option from command line. What do you think? |
Good point. However if WebExtensions will be enabled by default that will break backward compatibility (eg. if someone already used the cli to generate a project and uses it again the new version the outputs will differ). It might be not a big deal, just a thing to consider. |
I don't think this change will break existing code since we are adding a new feature and not replacing. And while releasing it we are going to mention it in our changelog file, so that user can know the version from which WebExtensions support was introduced. |
Alright @dutiyesh ! Should I then change it to something like --no-webextension in case somebody wants to build an extension without Webextension support? |
How about |
@dutiyesh I like it! Lets go with |
… --no-cross-browser In more detail: - if the crossBrowser env variable is true, browser-polyfill.js will be copied to the build folder. In order to get the env variable from webpack the exported common config object is converted to a function. All other webpack configs that use the common config have to explicitly call this function (with the env param) to get the common config object. - also, .html files now have a <%= polyfill => template, which gets replaced on build time. If crossBrowser is true, the browser-polyfill.js file gets included in the html file. Otherwise an empty string will replace the <%= polyfill => template
If the webextenstion support is not enabled, we need to copy the template files with .nocrosbbrowser.js ending. After that, these files are renamed and the .nocrosbbrowser extension is removed.
… update the original .js files to use the WebExtensions standard
…al files to use WebExtensions
@dutiyesh I think the PR is ready, I will test the generated outputs tomorrow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Andras-Simon Great work!
I have reviewed your pull request with comments, let me know if you have any questions.
And I came across few issues while I was testing:
- When I tried to create an extension with
no-cross-browser
command,webpack.config.js
file is not getting copied in project'sconfig
folder. (Probably because of its Regex) - For Popup extension in Firefox, I got this error in console - 'The storage API will not work with a temporary addon ID. Please add an explicit addon ID to your manifest.' (In Popup template, we are using
storage
API for storing Counter value.)
…d Promise handler
Hi! Any news on this? Thanks! |
The --webextension option will automatically add webextension-polyfill to your extension by default as discussed in #1
Please don't merge this PR yet.