pinafore/webpack/server.config.js
Nolan Lawson c98b96aa44
fix: move worker-loader to webpack config (#1405)
This avoids ESLint complaining about the `worker-loader!` declaration
2019-08-18 15:15:20 -07:00

43 lines
1.1 KiB
JavaScript

const webpack = require('webpack')
const config = require('sapper/config/webpack.js')
const pkg = require('../package.json')
const { mode, dev, resolve, inlineSvgs } = require('./shared.config')
const serverResolve = JSON.parse(JSON.stringify(resolve))
serverResolve.alias['page-lifecycle/dist/lifecycle.mjs'] = 'lodash-es/noop' // page lifecycle fails in Node
serverResolve.alias['../_workers/blurhash'] = 'lodash-es/noop' // not used on the server side
module.exports = {
entry: config.server.entry(),
output: config.server.output(),
target: 'node',
resolve: serverResolve,
externals: Object.keys(pkg.dependencies),
module: {
rules: [
{
test: /\.html$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader',
options: {
css: false,
store: true,
generate: 'ssr',
dev
}
}
}
]
},
mode,
performance: {
hints: false // it doesn't matter if server.js is large
},
plugins: [
new webpack.DefinePlugin({
'process.env.INLINE_SVGS': JSON.stringify(inlineSvgs)
})
]
}