webpack.sw.config.js 510 Bytes

const path = require('path');

module.exports = {
    mode: 'production',
    entry: {
        sw: path.join(__dirname, '../public/js/pwa/sw.js')
    },
    output: {
        path: path.join(__dirname, '../public/static'),
        filename: '[name].js'
    },
    target: 'webworker',
    module: {
        rules: [{
            test: /\.js$/,
            include: [path.join(__dirname, '../node_modules/workbox-sw'), path.join(__dirname, '../public/js')],
            use: 'babel-loader'
        }]
    }
};