webpack.sw.config.js 677 Bytes
const webpack = require('webpack');
const path = require('path');

module.exports = {
    entry: {
        sw: path.join(__dirname, '../js/pwa/sw.js')
    },
    output: {
        path: path.join(__dirname, '../static'),
        filename: '[name].js'
    },
    target: 'webworker',
    module: {
        rules: [{
            test: /\.(js|mjs)$/,
            include: [path.join(__dirname, '../../node_modules/workbox-sw')],
            use: 'babel-loader'
        }]
    },
    plugins: [
        new webpack.DefinePlugin({
            'process.env': {
                NODE_ENV: '"production"'
            }
        }),
        new webpack.optimize.UglifyJsPlugin()
    ]
};