1 const MiniCssExtractPlugin = require('mini-css-extract-plugin');
2 const nodeExternals = require('webpack-node-externals');
3 const CopyPlugin = require('copy-webpack-plugin');
4 const path = require('path');
5 const webpack = require('webpack');
8 hash:[hash], chunkhash:[chunkhash], name:[name], filebase:[filebase], query:[query], file:[file]
9 Source code: https://github.com/LemmyNet/lemmy-ui
11 @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
14 module.exports = function (env, _) {
16 // mode is set by package.json flags
17 entry: './src/server/index.tsx', // Point to main file
19 path: path.resolve(process.cwd(), 'dist'),
20 filename: 'js/server.js',
24 extensions: ['.js', '.jsx', '.ts', '.tsx'],
32 test: /\.(scss|css)$/i,
33 use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
36 test: /\.(js|jsx|tsx|ts)$/, // All ts and tsx files will be process by
37 loaders: 'babel-loader', // first babel-loader, then ts-loader
38 exclude: /node_modules/, // ignore node_modules
45 historyApiFallback: true,
48 new MiniCssExtractPlugin({
49 filename: 'styles/styles.css',
52 patterns: [{ from: './src/assets', to: './assets' }],
54 new webpack.BannerPlugin({
60 // server-specific configuration
61 if (env.platform === 'server') {
63 base.externals = [nodeExternals(), 'inferno-helmet'];
65 // client-specific configurations
66 if (env.platform === 'client') {
67 base.entry = './src/client/index.tsx';
68 base.output.filename = 'js/client.js';