import { defineConfig } from '@rsbuild/core'; import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginQRCode } from '@lynx-js/qrcode-rsbuild-plugin'; import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'; import { pluginLynx } from '@lynx-js/rsbuild-plugin'; const enableBundleAnalysis = !!process.env['RSPEEDY_BUNDLE_ANALYSIS']; export default defineConfig({ source: { entry: { main: './src/index.tsx', }, }, environments: { lynx: {}, }, plugins: [ pluginLynx({ performance: { profile: enableBundleAnalysis, }, }), pluginReactLynx(), pluginBabel({ include: /\.(?:jsx|tsx)$/, babelLoaderOptions(opts) { opts.plugins?.unshift([ 'babel-plugin-react-compiler', // See https://react.dev/reference/react-compiler/configuration for config { // ReactLynx only supports target to version 17 target: '17', }, ]); }, }), pluginQRCode({ schema(url) { // We use `?fullscreen=true` to open the page in LynxExplorer in full screen mode return `${url}?fullscreen=true`; }, }), ], });