An utility package to change the default Rails Webpacker configuration and add support for Service Workers
npm install webpacker-pwa* Overrides default Webpacker configuration transparently
* Compiles service workers directly in the public folder.
* Allows to code service workers and use webpack-dev-server.
* No changes are needed server-side
* Works without Sprockets.
1. Install the npm package:
bin/yarn add webpacker-wpa
2. Edit config/webpack/environment.js:
const { resolve } = require('path');
const { config, environment, Environment } = require('@rails/webpacker');
const WebpackerPwa = require('webpacker-pwa');
new WebpackerPwa(config, environment);
module.exports = environment;
3. Define the service workers folder in config/webpacker.yml
service_workers_entry_path: service_workers
Start writing your Progressive Rails App! :tada:
The package is doing a lot of changes on the default Webpacker configuration.
If some configurations change on Webpacker, this package might need to be updated.
The current version has been tested with Webpacker >= 4.0.