webpack.sw.config.js 492 Bytes

const path = require('path');

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