Files
githubpage/rspack.config.ts
Jabberwocky238 c45b436b12
Deploy to GitHub Pages / build (push) Failing after 1m59s
Deploy to GitHub Pages / deploy (push) Has been skipped
i
2026-07-05 21:43:51 -04:00

54 lines
1.2 KiB
TypeScript

import { defineConfig } from '@rspack/cli';
import { rspack, type SwcLoaderOptions } from '@rspack/core';
import { ReactRefreshRspackPlugin } from '@rspack/plugin-react-refresh';
const isDev = process.env.NODE_ENV === 'development';
export default defineConfig({
entry: {
main: './src/main.tsx',
},
target: ['browserslist:last 2 versions, > 0.2%, not dead, Firefox ESR'],
resolve: {
extensions: ['...', '.ts', '.tsx', '.jsx'],
},
module: {
rules: [
{
test: /\.svg$/,
type: 'asset',
},
{
test: /\.css$/,
type: 'css/auto',
},
{
test: /\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/,
use: [
{
loader: 'builtin:swc-loader',
options: {
detectSyntax: 'auto',
jsc: {
transform: {
react: {
runtime: 'automatic',
development: isDev,
refresh: isDev,
},
},
},
} satisfies SwcLoaderOptions,
},
],
},
],
},
plugins: [
new rspack.HtmlRspackPlugin({
template: './index.html',
}),
isDev && new ReactRefreshRspackPlugin(),
],
});