mirror of
https://github.com/nolanlawson/pinafore
synced 2024-12-12 18:28:03 +01:00
33 lines
897 B
JavaScript
33 lines
897 B
JavaScript
const config = require('sapper/config/webpack.js')
|
|
const terser = require('./terser.config')
|
|
const webpack = require('webpack')
|
|
const { mode, dev, resolve } = require('./shared.config')
|
|
const legacyBabel = require('./legacyBabel.config')
|
|
|
|
module.exports = {
|
|
entry: config.serviceworker.entry(),
|
|
output: config.serviceworker.output(),
|
|
resolve,
|
|
mode,
|
|
devtool: dev ? 'inline-source-map' : 'source-map',
|
|
module: {
|
|
rules: [
|
|
process.env.LEGACY && legacyBabel()
|
|
].filter(Boolean)
|
|
},
|
|
optimization: dev ? {} : {
|
|
minimize: !process.env.DEBUG,
|
|
minimizer: [
|
|
terser()
|
|
]
|
|
},
|
|
plugins: [
|
|
new webpack.DefinePlugin({
|
|
'process.browser': true,
|
|
'process.env.NODE_ENV': JSON.stringify(mode),
|
|
'process.env.LEGACY': !!process.env.LEGACY,
|
|
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now()
|
|
})
|
|
].filter(Boolean)
|
|
}
|