namesny-com/webpack.server.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-03-27 18:10:50 +00:00
const { resolve } = require('path')
const nodeExternals = require('webpack-node-externals')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
2020-01-10 23:31:56 +00:00
const WebpackCleanupPlugin = require('webpack-cleanup-plugin')
2019-03-27 18:10:50 +00:00
const serverConfig = {
entry: './src/server.js',
target: 'node',
externals: [nodeExternals()],
output: {
path: resolve(__dirname, 'build'),
filename: 'server.js',
publicPath: '/'
},
module: {
rules: [
{
test: /\.js$/,
use: [
'babel-loader'
],
exclude: '/node_modules/'
},
{
test: /\.scss$/,
use: [
{
loader: 'css-loader',
options: {
2019-09-22 18:01:43 +00:00
modules: {
localIdentName: '[name]__[local]___[hash:base64:5]'
},
onlyLocals: true,
importLoaders: 2
2019-03-27 18:10:50 +00:00
}
},
{
loader: 'postcss-loader'
},
{
loader: 'sass-loader'
}
]
},
{
test: /\.(png|jpg)$/,
exclude: /node_modules/,
loader: 'url-loader',
options: {
limit: 10000
}
}
]
},
plugins: [
new MiniCssExtractPlugin(),
2020-01-10 23:31:56 +00:00
new WebpackCleanupPlugin()
2019-03-27 18:10:50 +00:00
]
}
module.exports = serverConfig