|
1 | 1 | import path from 'node:path' |
2 | 2 | import { fileURLToPath } from 'node:url' |
| 3 | +import { mergeRsbuildConfig } from '@rsbuild/core' |
3 | 4 | import { pluginBabel } from '@rsbuild/plugin-babel' |
4 | 5 | import type { StorybookConfig } from 'storybook-react-native-web-rsbuild' |
5 | 6 |
|
@@ -40,24 +41,24 @@ const config: StorybookConfig = { |
40 | 41 | // This is needed because react-native-reanimated (in modulesToTranspile) |
41 | 42 | // gets its JSX transformed to use nativewind/jsx-runtime, but can't resolve |
42 | 43 | // nativewind from deep within pnpm's .pnpm directory structure |
43 | | - config.resolve ??= {} |
44 | | - config.resolve.alias = { |
45 | | - ...config.resolve.alias, |
46 | | - nativewind: nativewindPath, |
47 | | - } |
48 | | - |
49 | | - config.plugins?.push( |
50 | | - pluginBabel({ |
51 | | - // KEY: Only transform src files to avoid transforming Rsbuild internals |
52 | | - // Use [\\/] to match both Unix (/) and Windows (\) path separators |
53 | | - include: /[\\/]src[\\/]/, |
54 | | - babelLoaderOptions: { |
55 | | - presets: ['@babel/preset-typescript', 'nativewind/babel'], |
56 | | - plugins: ['@babel/plugin-proposal-export-namespace-from'], |
| 44 | + return mergeRsbuildConfig(config, { |
| 45 | + resolve: { |
| 46 | + alias: { |
| 47 | + nativewind: nativewindPath, |
57 | 48 | }, |
58 | | - }), |
59 | | - ) |
60 | | - return config |
| 49 | + }, |
| 50 | + plugins: [ |
| 51 | + pluginBabel({ |
| 52 | + // KEY: Only transform src files to avoid transforming Rsbuild internals |
| 53 | + // Use [\\/] to match both Unix (/) and Windows (\) path separators |
| 54 | + include: /[\\/]src[\\/]/, |
| 55 | + babelLoaderOptions: { |
| 56 | + presets: ['@babel/preset-typescript', 'nativewind/babel'], |
| 57 | + plugins: ['@babel/plugin-proposal-export-namespace-from'], |
| 58 | + }, |
| 59 | + }), |
| 60 | + ], |
| 61 | + }) |
61 | 62 | }, |
62 | 63 | } |
63 | 64 |
|
|
0 commit comments