1 const webpack = require("webpack");
2 const MiniCssExtractPlugin = require("mini-css-extract-plugin");
3 const nodeExternals = require("webpack-node-externals");
4 const CopyPlugin = require("copy-webpack-plugin");
5 const RunNodeWebpackPlugin = require("run-node-webpack-plugin");
6 const { merge } = require("lodash");
9 hash:[contentHash], chunkhash:[chunkhash], name:[name], filebase:[base], query:[query], file:[file]
10 Source code: https://github.com/LemmyNet/lemmy-ui
12 @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
17 filename: "js/server.js",
19 hashFunction: "xxhash64",
22 extensions: [".js", ".jsx", ".ts", ".tsx"],
30 test: /\.(scss|css)$/i,
31 use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
34 test: /\.(js|jsx|tsx|ts)$/, // All ts and tsx files will be process by
35 exclude: /node_modules/, // ignore node_modules
36 loader: "babel-loader",
38 // Due to some weird babel issue: https://github.com/webpack/webpack/issues/11467
42 fullySpecified: false,
48 new MiniCssExtractPlugin({
49 filename: "styles/styles.css",
52 patterns: [{ from: "./src/assets", to: "./assets" }],
54 new webpack.BannerPlugin({
60 const createServerConfig = (_env, mode) => {
61 const config = merge({}, base, {
63 entry: "./src/server/index.tsx",
65 filename: "js/server.js",
68 externals: [nodeExternals(), "inferno-helmet"],
71 if (mode === "development") {
78 new RunNodeWebpackPlugin({
79 runOnlyInWatchMode: true,
86 const createClientConfig = (_env, mode) => {
87 const config = merge({}, base, {
89 entry: "./src/client/index.tsx",
91 filename: "js/client.js",
95 if (mode === "development") {
105 module.exports = (env, properties) => [
106 createServerConfig(env, properties.mode || "development"),
107 createClientConfig(env, properties.mode || "development"),