Newer
Older

Matthias Konitzny
committed
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");

Matthias Konitzny
committed
const babelOptions = {
plugins: ["@babel/plugin-transform-runtime"],

Matthias Konitzny
committed
presets: ["@babel/preset-env", "@babel/preset-react"],
};
module.exports = {
entry: {
frontend: "./src/frontend.tsx",

Matthias Konitzny
committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
backend: "./src/backend.js",
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "build"),
clean: true,
},
module: {
rules: [
{
test: /\.ts(x?)$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: babelOptions,
},
{
loader: "ts-loader",
},
],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
options: babelOptions,
},
],
},
{
test: /\.css$/i,

Matthias Konitzny
committed
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},

Matthias Konitzny
committed
optimization: {

Matthias Konitzny
committed
moduleIds: "deterministic",
runtimeChunk: "single",
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks: "all",
},
},
},
},
};