-
Notifications
You must be signed in to change notification settings - Fork 210
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
Offer an easier way to upgrade the polyfill in a WebExtension #7
Comments
Why don't publish this project as an npm package? It would solve lots of problems. |
I would like this as well. Is there something technical that would stop this from happening? |
This addresses [issue 7] by making it possible for users to run: ```sh npm install https://github.com/mozilla/webextension-polyfill ``` and download a module that they can use with a bundler as follows: ```js import browser from 'webextension-polyfill'; ``` Also, add a [prepublish script] so that users don't need to run `grunt` manually. In addition, specify [files] in package.json so that this module can be published to npm without including miscellanea. This can be verified by running: ```sh npm pack && tar -tvf webextension-polyfill-0.1.0.tgz ``` The `dist/` files would be generated upon publishing the package, meaning that users could run `npm install webextension-polyfill`, then load the following files into their extension, without having to build them: ``` node_modules/webextension-polyfill/dist/browser-polyfill.js node_modules/webextension-polyfill/dist/browser-polyfill.min.js ``` [issue 7]: mozilla#7 [files]: https://docs.npmjs.com/files/package.json#files [prepublish script]: https://docs.npmjs.com/misc/scripts
This addresses [issue 7] by making it possible for users to run: ```sh npm install https://github.com/mozilla/webextension-polyfill ``` and download a module that they can use with a bundler as follows: ```js import browser from 'webextension-polyfill'; ``` Also, add a [prepublish script] so that users don't need to run `grunt` manually. In addition, specify [files] in package.json so that this module can be published to npm without including miscellanea. This can be verified by running: ```sh npm pack && tar -tvf webextension-polyfill-0.1.0.tgz ``` The `dist/` files would be generated upon publishing the package, meaning that users could run `npm install webextension-polyfill`, then load the following files into their extension, without having to build them: ``` node_modules/webextension-polyfill/dist/browser-polyfill.js node_modules/webextension-polyfill/dist/browser-polyfill.min.js ``` [issue 7]: mozilla#7 [files]: https://docs.npmjs.com/files/package.json#files [prepublish script]: https://docs.npmjs.com/misc/scripts
See #17 for a patch that makes it possible to If you'd like, you can go ahead and install it from github using:
|
This addresses [issue 7] by making it possible for users to run: ```sh npm install webextension-polyfill ``` and download a module that they can use with a bundler as follows: ```js import browser from 'webextension-polyfill'; ``` Also, add a [prepublish script] so that users who clone the repo don't need to run `grunt` manually. In addition, specify [files] in package.json so that this module can be published to npm without including miscellanea. This can be verified by running: ```sh npm pack && tar -tvf webextension-polyfill-0.1.0.tgz ``` [issue 7]: mozilla#7 [files]: https://docs.npmjs.com/files/package.json#files [prepublish script]: https://docs.npmjs.com/misc/scripts
This addresses [issue 7] by making it possible for users to run: ```sh npm install webextension-polyfill ``` and download a module that they can use with a bundler as follows: ```js import browser from 'webextension-polyfill'; ``` Also, add a [prepublish script] so that users who clone the repo don't need to run `grunt` manually. In addition, specify [files] in package.json so that this module can be published to npm without including miscellanea. This can be verified by running: ```sh npm pack && tar -tvf webextension-polyfill-0.1.0.tgz ``` [issue 7]: mozilla#7 [files]: https://docs.npmjs.com/files/package.json#files [prepublish script]: https://docs.npmjs.com/misc/scripts
This should now be fixed (by #17, #35): the built files are published on npm: The npm package provides the polyfill wrapped as an UMD module and so, besides being used with bundling tools like browserify or webpack, it can also be used to retrieve a defined version when the project doesn't use (or doesn't want to use) a module bundler. In #20 we are going to discuss how to provide the built files also on a public static url, as an additional way to retrieve the released versions without building the polyfill from sources. |
Adding build in github release could be nice ;-) So anyone can dl the build and place it in his project. |
The documentation currently suggests this approach for installing the polyfill in a WebExtension:
webextension-polyfill
repoThis works fine the first time but it doesn't offer an easy way to upgrade the polyfill when the upstream source changes.
Can you document (or implement) a better way? There would be a couple ways to approach it. The first thing that comes to mind is this:
package.json
to the WebExtensionwebextension-polyfill
as a dependencynode_modules
and build an es6-friendly distribution for your WebExtension source filesPerhaps there is a simpler way that does not involve babel transpilation. Maybe with bower ?
The text was updated successfully, but these errors were encountered: