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',
21 extensions: ['.js', '.jsx', '.ts', '.tsx'],
29 test: /\.(scss|css)$/i,
30 use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
33 test: /\.(js|jsx|tsx|ts)$/, // All ts and tsx files will be process by
34 exclude: /node_modules/, // ignore node_modules
35 loader: 'babel-loader',
37 // Due to some weird babel issue: https://github.com/webpack/webpack/issues/11467
41 fullySpecified: false,
47 new MiniCssExtractPlugin({
48 filename: 'styles/styles.css',
51 patterns: [{ from: './src/assets', to: './assets' }],
53 new webpack.BannerPlugin({
59 const createServerConfig = (_env, mode) => {
60 const config = merge({}, base, {
62 entry: './src/server/index.tsx',
64 filename: 'js/server.js',
67 externals: [nodeExternals(), 'inferno-helmet'],
70 if (mode === 'development') {
77 new RunNodeWebpackPlugin({
78 runOnlyInWatchMode: true,
85 const createClientConfig = (_env, mode) => {
86 const config = merge({}, base, {
88 entry: './src/client/index.tsx',
90 filename: 'js/client.js',
94 if (mode === 'development') {
104 module.exports = (env, properties) => [
105 createServerConfig(env, properties.mode || 'development'),
106 createClientConfig(env, properties.mode || 'development'),