mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-02 06:28:52 +00:00
77 lines
1.5 KiB
JavaScript
77 lines
1.5 KiB
JavaScript
const webpack = require('webpack');
|
|
const path = require('path');
|
|
const RemovePlugin = require('remove-files-webpack-plugin');
|
|
|
|
const buildPath = path.resolve(__dirname, 'dist');
|
|
|
|
const server = {
|
|
entry: './server/server.ts',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: ['ts-loader'],
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new RemovePlugin({
|
|
before: {
|
|
include: [path.resolve(buildPath, 'server')],
|
|
},
|
|
watch: {
|
|
include: [path.resolve(buildPath, 'server')],
|
|
},
|
|
}),
|
|
// Ignore cardinal as its optional
|
|
new webpack.IgnorePlugin(/^cardinal$/, /./),
|
|
],
|
|
optimization: {
|
|
minimize: true,
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js'],
|
|
},
|
|
output: {
|
|
filename: '[contenthash].server.js',
|
|
path: path.resolve(buildPath, 'server'),
|
|
},
|
|
target: 'node',
|
|
};
|
|
|
|
const client = {
|
|
entry: './client/client.ts',
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.tsx?$/,
|
|
use: ['ts-loader'],
|
|
exclude: /node_modules/,
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new RemovePlugin({
|
|
before: {
|
|
include: [path.resolve(buildPath, 'client')],
|
|
},
|
|
watch: {
|
|
include: [path.resolve(buildPath, 'client')],
|
|
},
|
|
}),
|
|
],
|
|
optimization: {
|
|
minimize: true,
|
|
},
|
|
resolve: {
|
|
extensions: ['.tsx', '.ts', '.js'],
|
|
},
|
|
output: {
|
|
filename: '[contenthash].client.js',
|
|
path: path.resolve(buildPath, 'client'),
|
|
},
|
|
};
|
|
|
|
module.exports = [server, client];
|