pinafore/webpack/service-worker.config.js
Nolan Lawson 0022286b46
fix: first stab at i18n, extract English strings, add French (#1904)
* first attempt

* progress

* working

* working

* test timeago

* rm

* get timeago working

* reduce size

* fix whitespace

* more intl stuff

* more effort

* more work

* more progress

* more work

* more intl

* set lang=LOCALE

* flatten

* more work

* add ltr/rtl

* more work

* add comments

* yet more work

* still more work

* more work

* fix tests

* more test and string fixes

* fix test

* fix test

* fix test

* fix some more strings, add test

* fix snackbar

* fix }

* fix typo

* fix english

* measure perf

* start on french

* more work on french

* more french

* more french

* finish french

* fix some missing translations

* update readme

* fix test
2020-11-29 14:13:27 -08:00

41 lines
1 KiB
JavaScript

import { LOCALE } from '../src/routes/_static/intl'
import path from 'path'
const config = require('sapper/config/webpack.js')
const terser = require('./terser.config')
const webpack = require('webpack')
const { mode, dev, resolve } = require('./shared.config')
module.exports = {
entry: config.serviceworker.entry(),
output: config.serviceworker.output(),
resolve,
mode,
devtool: dev ? 'inline-source-map' : 'source-map',
optimization: dev ? {} : {
minimize: !process.env.DEBUG,
minimizer: [
terser()
]
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: path.join(__dirname, './svelte-intl-loader.js')
}
}
]
},
plugins: [
new webpack.DefinePlugin({
'process.browser': true,
'process.env.NODE_ENV': JSON.stringify(mode),
'process.env.SAPPER_TIMESTAMP': process.env.SAPPER_TIMESTAMP || Date.now(),
'process.env.LOCALE': JSON.stringify(LOCALE)
})
].filter(Boolean)
}