2020-11-29 23:13:27 +01:00
|
|
|
import { LOCALE } from '../src/routes/_static/intl'
|
|
|
|
import path from 'path'
|
|
|
|
|
2021-07-05 05:19:04 +02:00
|
|
|
import config from 'sapper/config/webpack.js'
|
|
|
|
import terser from './terser.config'
|
|
|
|
import webpack from 'webpack'
|
|
|
|
import { mode, dev, resolve } from './shared.config'
|
2018-12-11 16:31:48 +01:00
|
|
|
|
2021-07-05 05:19:04 +02:00
|
|
|
export default {
|
2018-12-11 16:31:48 +01:00
|
|
|
entry: config.serviceworker.entry(),
|
|
|
|
output: config.serviceworker.output(),
|
2018-12-18 09:43:51 +01:00
|
|
|
resolve,
|
2018-12-16 04:21:20 +01:00
|
|
|
mode,
|
|
|
|
devtool: dev ? 'inline-source-map' : 'source-map',
|
2021-02-20 22:40:33 +01:00
|
|
|
optimization: dev
|
|
|
|
? {}
|
|
|
|
: {
|
|
|
|
minimize: !process.env.DEBUG,
|
|
|
|
minimizer: [
|
|
|
|
terser()
|
|
|
|
]
|
|
|
|
},
|
2020-11-29 23:13:27 +01:00
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.js$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
2021-07-05 05:19:04 +02:00
|
|
|
loader: path.join(__dirname, './svelte-intl-loader.cjs')
|
2020-11-29 23:13:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2018-12-11 16:31:48 +01:00
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
2018-12-16 02:36:36 +01:00
|
|
|
'process.browser': true,
|
2018-12-16 04:21:20 +01:00
|
|
|
'process.env.NODE_ENV': JSON.stringify(mode),
|
2020-11-29 23:13:27 +01:00
|
|
|
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now(),
|
2021-03-14 18:20:23 +01:00
|
|
|
'process.env.LOCALE': JSON.stringify(LOCALE),
|
|
|
|
'process.env.IS_SERVICE_WORKER': 'true'
|
2019-10-08 16:57:37 +02:00
|
|
|
})
|
2019-09-21 22:44:32 +02:00
|
|
|
].filter(Boolean)
|
2018-12-11 16:31:48 +01:00
|
|
|
}
|