Files
new-phone-who-dis/resources/webpack.config.js
T
2020-10-07 16:11:00 -04:00

76 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 webpack.DefinePlugin({ "global.GENTLY": false }),
new RemovePlugin({
before: {
include: [path.resolve(buildPath, "server")],
},
watch: {
include: [path.resolve(buildPath, "server")],
},
}),
],
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];