Skip to content

Instantly share code, notes, and snippets.

@binarykitchen
Created January 26, 2025 06:06
Show Gist options
  • Save binarykitchen/39de7e07fc000a5ec9c60666fa939e4b to your computer and use it in GitHub Desktop.
Save binarykitchen/39de7e07fc000a5ec9c60666fa939e4b to your computer and use it in GitHub Desktop.
export default {
target: [
'web',
'es2017'
],
name: 'client',
devtool: 'cheap-module-source-map',
context: '/home/michael-heuberger/code/binarykitchen/videomail.io',
mode: 'development',
infrastructureLogging: {
level: 'error'
},
watchOptions: {
ignored: /[\\/](?:\.git|node_modules)[\\/]/,
aggregateTimeout: 0
},
experiments: {
asyncWebAssembly: true
},
output: {
devtoolModuleFilenameTemplate: (info)=>toPosixPath(__WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.resolve(info.absoluteResourcePath)),
path: '/home/michael-heuberger/code/binarykitchen/videomail.io/var/local/www',
filename: 'static/js/[name].js',
chunkFilename: 'static/js/async/[name].js',
publicPath: '/',
pathinfo: false,
hashFunction: 'xxhash64',
assetModuleFilename: 'static/assets/[name].[contenthash:8][ext]',
webassemblyModuleFilename: 'static/wasm/[hash].module.wasm'
},
resolve: {
tsConfig: {
configFile: '/home/michael-heuberger/code/binarykitchen/videomail.io/tsconfig.json',
references: 'auto'
},
alias: {
'@swc/helpers': '/home/michael-heuberger/code/binarykitchen/videomail.io/node_modules/@swc/helpers'
},
extensionAlias: {
'.js': [
'.js',
'.ts',
'.tsx'
],
'.jsx': [
'.jsx',
'.tsx'
]
},
extensions: [
'.ts',
'.tsx',
'.mjs',
'.js',
'.jsx',
'.json'
]
},
module: {
parser: {
javascript: {
exportsPresence: 'error'
}
},
rules: [
/* config.module.rule('mjs') */
{
test: /\.m?js/,
resolve: {
fullySpecified: false
}
},
/* config.module.rule('css') */
{
test: /\.css$/,
type: 'javascript/auto',
dependency: {
not: 'url'
},
sideEffects: true,
use: [
/* config.module.rule('css').use('mini-css-extract') */
{
loader: '/home/michael-heuberger/code/binarykitchen/videomail.io/node_modules/@rspack/core/dist/cssExtractLoader.js'
},
/* config.module.rule('css').use('css') */
{
loader: '/home/michael-heuberger/code/binarykitchen/videomail.io/node_modules/@rsbuild/core/compiled/css-loader/index.js',
options: {
importLoaders: 1,
modules: {
auto: true,
namedExport: false,
exportGlobals: false,
exportLocalsConvention: 'camelCase',
localIdentName: '[path][name]__[local]-[hash:base64:6]'
},
sourceMap: false
}
},
/* config.module.rule('css').use('lightningcss') */
{
loader: 'builtin:lightningcss-loader',
options: {
targets: [
'chrome >= 87',
'edge >= 88',
'firefox >= 78',
'safari >= 14'
]
}
}
],
resolve: {
preferRelative: true
}
},
/* config.module.rule('js') */
{
test: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
type: 'javascript/auto',
dependency: {
not: 'url'
},
include: [
{
and: [
'/home/michael-heuberger/code/binarykitchen/videomail.io',
{
not: /[\\/]node_modules[\\/]/
}
]
},
/\.(?:ts|tsx|jsx|mts|cts)$/,
/[\\/]@rsbuild[\\/]core[\\/]dist[\\/]/
],
use: [
/* config.module.rule('js').use('swc') */
{
loader: 'builtin:swc-loader',
options: {
jsc: {
externalHelpers: true,
parser: {
tsx: false,
syntax: 'typescript',
decorators: true
},
experimental: {
cacheRoot: '/home/michael-heuberger/code/binarykitchen/videomail.io/node_modules/.cache/.swc',
keepImportAttributes: true
},
transform: {
legacyDecorator: false,
decoratorVersion: '2022-03'
}
},
isModule: 'unknown',
env: {
targets: [
'chrome >= 87',
'edge >= 88',
'firefox >= 78',
'safari >= 14'
],
mode: undefined
}
}
}
]
},
/* config.module.rule('js-data-uri') */
{
mimetype: {
or: [
'text/javascript',
'application/javascript'
]
},
use: [
/* config.module.rule('js-data-uri').use('swc') */
{
loader: 'builtin:swc-loader',
options: {
jsc: {
externalHelpers: true,
parser: {
tsx: false,
syntax: 'typescript',
decorators: true
},
experimental: {
cacheRoot: '/home/michael-heuberger/code/binarykitchen/videomail.io/node_modules/.cache/.swc',
keepImportAttributes: true
},
transform: {
legacyDecorator: false,
decoratorVersion: '2022-03'
}
},
isModule: 'unknown',
env: {
targets: [
'chrome >= 87',
'edge >= 88',
'firefox >= 78',
'safari >= 14'
],
mode: undefined
}
}
}
],
resolve: {
fullySpecified: false
}
},
/* config.module.rule('image') */
{
test: /\.(?:png|jpg|jpeg|pjpeg|pjp|gif|bmp|webp|ico|apng|avif|tif|tiff|jfif|cur)$/i,
oneOf: [
/* config.module.rule('image').oneOf('image-asset-url') */
{
type: 'asset/resource',
resourceQuery: /(__inline=false|url)/,
generator: {
filename: 'static/image/[name].[contenthash:8][ext]'
}
},
/* config.module.rule('image').oneOf('image-asset-inline') */
{
type: 'asset/inline',
resourceQuery: /inline/
},
/* config.module.rule('image').oneOf('image-asset') */
{
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4096
}
},
generator: {
filename: 'static/image/[name].[contenthash:8][ext]'
}
}
]
},
/* config.module.rule('svg') */
{
test: /\.svg$/i,
oneOf: [
/* config.module.rule('svg').oneOf('svg-asset-url') */
{
type: 'asset/resource',
resourceQuery: /(__inline=false|url)/,
generator: {
filename: 'static/svg/[name].[contenthash:8].svg'
}
},
/* config.module.rule('svg').oneOf('svg-asset-inline') */
{
type: 'asset/inline',
resourceQuery: /inline/
},
/* config.module.rule('svg').oneOf('svg-asset') */
{
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4096
}
},
generator: {
filename: 'static/svg/[name].[contenthash:8].svg'
}
}
]
},
/* config.module.rule('media') */
{
test: /\.(?:mp4|webm|ogg|mov|mp3|wav|flac|aac|m4a|opus)$/i,
oneOf: [
/* config.module.rule('media').oneOf('media-asset-url') */
{
type: 'asset/resource',
resourceQuery: /(__inline=false|url)/,
generator: {
filename: 'static/media/[name].[contenthash:8][ext]'
}
},
/* config.module.rule('media').oneOf('media-asset-inline') */
{
type: 'asset/inline',
resourceQuery: /inline/
},
/* config.module.rule('media').oneOf('media-asset') */
{
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4096
}
},
generator: {
filename: 'static/media/[name].[contenthash:8][ext]'
}
}
]
},
/* config.module.rule('font') */
{
test: /\.(?:woff|woff2|eot|ttf|otf|ttc)$/i,
oneOf: [
/* config.module.rule('font').oneOf('font-asset-url') */
{
type: 'asset/resource',
resourceQuery: /(__inline=false|url)/,
generator: {
filename: 'static/font/[name].[contenthash:8][ext]'
}
},
/* config.module.rule('font').oneOf('font-asset-inline') */
{
type: 'asset/inline',
resourceQuery: /inline/
},
/* config.module.rule('font').oneOf('font-asset') */
{
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: 4096
}
},
generator: {
filename: 'static/font/[name].[contenthash:8][ext]'
}
}
]
},
/* config.module.rule('wasm') */
{
test: /\.wasm$/,
dependency: 'url',
type: 'asset/resource',
generator: {
filename: 'static/wasm/[hash].module.wasm'
}
}
]
},
optimization: {
minimize: false,
splitChunks: {
chunks: 'all',
cacheGroups: {
'lib-axios': {
test: /node_modules[\\/]axios(-.+)?[\\/]/,
priority: 0,
name: 'lib-axios'
}
}
}
},
plugins: [
/* config.plugin('RsbuildCorePlugin') */
{},
/* config.plugin('hmr') */
new HotModuleReplacementPlugin(),
/* config.plugin('mini-css-extract') */
new CssExtractRspackPlugin(
{
filename: 'static/css/[name].css',
chunkFilename: 'static/css/async/[name].css',
ignoreOrder: true
}
),
/* config.plugin('html-index') */
new HtmlRspackPlugin(
{
meta: {
charset: {
charset: 'UTF-8'
},
viewport: 'width=device-width,initial-scale=1',
'apple-mobile-web-app-status-bar-style': '#bbb',
author: 'Michael Heuberger, Binary Kitchen',
'msapplication-navbutton-color': '#bbb',
'theme-color': '#bbb'
},
chunks: [
'index'
],
inject: 'head',
filename: 'index.html',
entryName: 'index',
templateParameters: (compilation, assets, assetTags, pluginOptions)=>{
let { mountId, templateParameters } = config.html, rspackConfig = compilation.options, htmlPlugin = {
tags: assetTags,
files: assets,
options: pluginOptions
};
return reduceConfigsWithContext({
initial: {
mountId,
entryName: entryName,
assetPrefix: assetPrefix,
compilation,
htmlPlugin,
rspackConfig,
webpackConfig: rspackConfig,
htmlWebpackPlugin: htmlPlugin
},
config: templateParameters,
ctx: {
entryName: entryName
}
});
},
scriptLoading: 'defer',
template: '/home/michael-heuberger/code/binarykitchen/videomail.io/src/client/views/base.pug',
title: 'videomail.io'
}
),
/* config.plugin('rsbuild-html-plugin') */
new RsbuildHtmlPlugin(
{
index: {
templateContent: 'doctype html\nhtml(lang="en", data-environ=environ)\n head\n base(href="/")\n\n link(rel="dns-prefetch", href=developerUrl)\n link(rel="me", href=developerUrl)\n\n link(rel="preconnect", href="https://fonts.googleapis.com")\n link(rel="preconnect", href="https://fonts.gstatic.com", crossorigin)\n\n link(\n href="https://fonts.googleapis.com/css?family=Varela+Round&display=swap",\n rel="stylesheet",\n type="text/css"\n )\n\n meta(http-equiv="Cache-control", content="no-cache, no-store, must-revalidate")\n meta(http-equiv="Pragma", content="no-cache")\n meta(http-equiv="expires", content="-1")\n\n meta(name="robots", content="index,follow")\n meta(name="language", content="en")\n meta(name="description", content=description)\n meta(name="keywords", content=keywords)\n meta(\n name="google-site-verification",\n content="(REMOVED)"\n )\n meta(name="mobile-web-app-capable", content="yes")\n meta(name="apple-mobile-web-app-title", content=title)\n meta(name="application-name", content=title)\n meta(name="color-scheme", content="light dark")\n\n meta(name="referrer", content="always")\n\n body\n #root\n',
favicon: '/home/michael-heuberger/code/binarykitchen/videomail.io/src/client/assets/img/favicon.png'
}
},
()=>environment,
async (...args)=>(await context.hooks.modifyHTMLTags.callInEnvironment({
environment,
args
}))[0]
),
/* config.plugin('define') */
new DefinePlugin(
{
'import.meta.env.MODE': '"development"',
'import.meta.env.DEV': true,
'import.meta.env.PROD': false,
'import.meta.env.BASE_URL': '"/"',
'import.meta.env.ASSET_PREFIX': '""',
'process.env.BASE_URL': '"/"',
'process.env.ASSET_PREFIX': '""',
'process.env.ENVIRON': '"local"',
'process.env.VIDEOMAIL_OPTIONS': {
apiUrl: '"https://infernal.videomail.local:8443"',
clientUrl: '"https://infernal.videomail.local:8080"',
expireSeconds: '5184000',
imageQuality: '0.38',
pageName: '"videomail.io"',
rootEmail: '"[email protected]"',
slogan: '"Email videos from your cam right away"',
socketUrl: '"wss://infernal.videomail.local:8443"',
title: '"videomail.io"',
version: '"2.0.0"',
videoFps: '18',
videoHeight: '300',
videoLimitSeconds: '180',
videoWidth: '400',
googleTagID: 'REMOVED'
}
}
)
],
performance: {
hints: false,
maxAssetSize: 250000,
maxEntrypointSize: 250000
},
entry: {
index: [
'/home/michael-heuberger/code/binarykitchen/videomail.io/src/client/index.tsx'
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment