deemix-gui/server/webpack.config.js

46 lines
1007 B
JavaScript
Raw Normal View History

2021-12-21 17:56:24 +01:00
const path = require('path')
const webpack = require('webpack')
const NodemonPlugin = require('nodemon-webpack-plugin')
2021-07-02 19:57:06 +02:00
2021-12-21 17:56:24 +01:00
module.exports = env => {
const isProduction = !!env.production
const config = {
mode: isProduction ? 'production' : 'development',
entry: './src/app.ts',
devtool: isProduction ? false : 'eval',
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js']
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'app.js',
sourceMapFilename: '[file].map',
library: {
name: 'DeemixServer',
type: 'umd'
}
},
target: 'node',
plugins: [
new NodemonPlugin(),
new webpack.DefinePlugin({ 'global.GENTLY': false }),
new webpack.ContextReplacementPlugin(/[/\\](express|keyv)[/\\]/, data => {
delete data.dependencies[0].critical
return data
}),
new webpack.ContextReplacementPlugin(/yargs/)
]
}
2021-07-02 19:57:06 +02:00
2021-12-21 17:56:24 +01:00
return config
}