Skip to content

Instantly share code, notes, and snippets.

@jeffposnick
Created March 24, 2021 19:43
Show Gist options
  • Select an option

  • Save jeffposnick/364ed09e66cf01a84d2e60be44163ea6 to your computer and use it in GitHub Desktop.

Select an option

Save jeffposnick/364ed09e66cf01a84d2e60be44163ea6 to your computer and use it in GitHub Desktop.

Revisions

  1. jeffposnick created this gist Mar 24, 2021.
    17 changes: 17 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    {
    "name": "demo",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
    "build": "webpack"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "devDependencies": {
    "webpack": "^5.28.0",
    "webpack-cli": "^4.5.0",
    "workbox-webpack-plugin": "^6.1.2"
    }
    }
    14 changes: 14 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    const {GenerateSW} = require('workbox-webpack-plugin');
    const path = require('path');

    module.exports = {
    entry: './index.js',
    mode: 'development',
    output: {
    filename: 'index.[contenthash].js',
    path: path.join(__dirname, 'build'),
    },
    plugins: [
    new GenerateSW(),
    ],
    };