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:[contentHash], chunkhash:[chunkhash], name:[name], filebase:[base], 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 filename: 'js/server.js',
23 extensions: ['.js', '.jsx', '.ts', '.tsx'],
31 test: /\.(scss|css)$/i,
32 use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
35 test: /\.(js|jsx|tsx|ts)$/, // All ts and tsx files will be process by
36 exclude: /node_modules/, // ignore node_modules
37 loader: 'babel-loader',
39 // Due to some weird babel issue: https://github.com/webpack/webpack/issues/11467
43 fullySpecified: false,
51 historyApiFallback: true,
54 new MiniCssExtractPlugin({
55 filename: 'styles/styles.css',
58 patterns: [{ from: './src/assets', to: './assets' }],
60 new webpack.BannerPlugin({
66 // server-specific configuration
67 if (env.platform === 'server') {
69 base.externals = [nodeExternals(), 'inferno-helmet'];
71 // client-specific configurations
72 if (env.platform === 'client') {
73 base.entry = './src/client/index.tsx';
74 base.output.filename = 'js/client.js';