52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
const path = require('path');
|
|
const nodeExternals = require('webpack-node-externals');
|
|
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
|
|
const webpackconfig = {
|
|
target: 'node',
|
|
mode: 'development',
|
|
entry: {
|
|
server: path.resolve('lib/main.js')
|
|
},
|
|
resolve: {
|
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
alias: {
|
|
'app': path.resolve('app'),
|
|
'lib': path.resolve('lib'),
|
|
'config': path.resolve('config'),
|
|
'middleware': path.resolve('middleware'),
|
|
'public': path.resolve('public'),
|
|
},
|
|
},
|
|
devtool: 'eval-source-map',
|
|
output: {
|
|
filename: '[name].bundle.js',
|
|
path: path.resolve('./dist')
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\/(js|jsx)$/,
|
|
use: {
|
|
loader: 'babel-loader'
|
|
},
|
|
exclude: [path.resolve('/node_modules')]
|
|
}
|
|
],
|
|
},
|
|
externals: [nodeExternals()],
|
|
plugins: [
|
|
new CleanWebpackPlugin()
|
|
],
|
|
node: {
|
|
console: true,
|
|
global: true,
|
|
process: true,
|
|
Buffer: true,
|
|
__filename: true,
|
|
__dirname: true,
|
|
setImmediate: true,
|
|
path: true
|
|
}
|
|
}
|
|
module.exports = webpackconfig
|