Skip to content

Commit

Permalink
fix(webpack): restore file
Browse files Browse the repository at this point in the history
  • Loading branch information
neki-dev committed Oct 11, 2024
1 parent 6c09bfc commit e069f50
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions webpack/.client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
const CopyPlugin = require("copy-webpack-plugin");
const HtmlPlugin = require("html-webpack-plugin");
const path = require("path");
// const TerserPlugin = require("terser-webpack-plugin");

const sharedConfig = require("./.shared");
const tsconfig = require("../tsconfig.json");

const ROOT = path.resolve(__dirname, "..");
const OUTPUT = path.join(ROOT, tsconfig.compilerOptions.outDir, "public");

module.exports = (env, preset) => ({
...sharedConfig(env, preset),
name: "Client",
target: "web",
entry: path.join(ROOT, "src/client/index.tsx"),
output: {
path: OUTPUT,
filename: "bundle.[fullhash].js",
clean: true,
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: ["babel-loader", "ts-loader"],
},
{
test: /\.(svg|png|ttf|woff|woff2)$/,
exclude: /node_modules/,
type: "asset/resource",
generator: {
filename: "assets/[hash][ext]",
},
},
],
},
plugins: [
new HtmlPlugin({
minify: false,
template: "src/client/index.html",
}),
new CopyPlugin({
patterns: [
{
from: path.join(ROOT, "src/client/assets"),
to: path.join(OUTPUT, "assets"),
},
],
}),
],
devtool: preset.mode === "development" ? "inline-source-map" : "source-map",
optimization:
preset.mode === "development"
? undefined
: {
minimize: true,
// minimizer: [
// new TerserPlugin({
// terserOptions: {
// output: { comments: false },
// },
// }),
// ],
},
});

0 comments on commit e069f50

Please sign in to comment.