1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-14 11:27:45 +01:00
Pinafore-Web-Client-Frontend/webpack/server.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

74 lines
1.9 KiB
JavaScript

import { LOCALE } from '../src/routes/_static/intl'
const path = require('path')
const webpack = require('webpack')
const config = require('sapper/config/webpack.js')
const pkg = require('../package.json')
const { mode, dev, resolve, inlineSvgs, allSvgs } = require('./shared.config')
// modules that the server should ignore, either because they cause errors or warnings
// (because they're only used on the client side)
const NOOP_MODULES = [
'../_workers/blurhash',
'tesseract.js/dist/worker.min.js',
'tesseract.js/dist/worker.min.js.map',
'tesseract.js-core/tesseract-core.wasm',
'tesseract.js-core/tesseract-core.wasm.js',
'tesseract.js'
]
const serverResolve = JSON.parse(JSON.stringify(resolve))
serverResolve.alias = serverResolve.alias || {}
NOOP_MODULES.forEach(mod => {
serverResolve.alias[mod] = 'lodash-es/noop'
})
module.exports = {
entry: config.server.entry(),
output: config.server.output(),
target: 'node',
resolve: serverResolve,
externals: Object.keys(pkg.dependencies),
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: path.join(__dirname, './svelte-intl-loader.js')
}
},
{
test: /\.html$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
css: false,
store: true,
generate: 'ssr',
dev
}
}
},
{
loader: path.join(__dirname, './svelte-intl-loader.js')
}
]
},
mode,
performance: {
hints: false // it doesn't matter if server.js is large
},
optimization: dev ? {} : {
minimize: false
},
plugins: [
new webpack.DefinePlugin({
'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs),
'process.env.ALL_SVGS': JSON.stringify(allSvgs),
'process.env.LOCALE': JSON.stringify(LOCALE)
})
]
}