2019-03-03 03:02:06 +00:00
|
|
|
const webpack = require('webpack')
|
2018-12-11 15:31:48 +00:00
|
|
|
const config = require('sapper/config/webpack.js')
|
|
|
|
const pkg = require('../package.json')
|
2019-03-03 03:02:06 +00:00
|
|
|
const { mode, dev, resolve, inlineSvgs } = require('./shared.config')
|
2018-12-11 15:31:48 +00:00
|
|
|
|
2019-05-09 03:58:32 +01:00
|
|
|
const serverResolve = JSON.parse(JSON.stringify(resolve))
|
|
|
|
serverResolve.alias['page-lifecycle/dist/lifecycle.mjs'] = 'lodash-es/noop' // page lifecycle fails in Node
|
2019-08-18 23:15:20 +01:00
|
|
|
serverResolve.alias['../_workers/blurhash'] = 'lodash-es/noop' // not used on the server side
|
2019-05-09 03:58:32 +01:00
|
|
|
|
2018-12-11 15:31:48 +00:00
|
|
|
module.exports = {
|
|
|
|
entry: config.server.entry(),
|
|
|
|
output: config.server.output(),
|
|
|
|
target: 'node',
|
2019-05-09 03:58:32 +01:00
|
|
|
resolve: serverResolve,
|
2018-12-11 15:31:48 +00:00
|
|
|
externals: Object.keys(pkg.dependencies),
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.html$/,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'svelte-loader',
|
|
|
|
options: {
|
|
|
|
css: false,
|
|
|
|
store: true,
|
|
|
|
generate: 'ssr',
|
|
|
|
dev
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
2018-12-16 03:21:20 +00:00
|
|
|
mode,
|
2018-12-11 15:31:48 +00:00
|
|
|
performance: {
|
|
|
|
hints: false // it doesn't matter if server.js is large
|
2019-03-03 03:02:06 +00:00
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs)
|
|
|
|
})
|
|
|
|
]
|
2018-12-11 15:31:48 +00:00
|
|
|
}
|