Skip to content

Commit 9cb7c0b

Browse files
committed
fix(builder): should merge with user’s resolve.extensions
1 parent 5d3af9f commit 9cb7c0b

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

packages/builder-rsbuild/src/preview/iframe-rsbuild.config.ts

+16-9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ const maybeGetAbsolutePath = <I extends string>(input: I): I | false => {
2929
}
3030
}
3131

32+
const builtInResolveExtensions = [
33+
'.mjs',
34+
'.js',
35+
'.jsx',
36+
'.ts',
37+
'.tsx',
38+
'.json',
39+
'.cjs',
40+
]
41+
3242
const managerAPIPath = maybeGetAbsolutePath('@storybook/manager-api')
3343
const componentsPath = maybeGetAbsolutePath('@storybook/components')
3444
const globalPath = maybeGetAbsolutePath('@storybook/global')
@@ -289,15 +299,12 @@ export default async (
289299

290300
config.resolve ??= {}
291301
config.resolve.symlinks = !isPreservingSymlinks()
292-
config.resolve.extensions = [
293-
'.mjs',
294-
'.js',
295-
'.jsx',
296-
'.ts',
297-
'.tsx',
298-
'.json',
299-
'.cjs',
300-
]
302+
config.resolve.extensions = Array.from(
303+
new Set([
304+
...(config.resolve.extensions ?? []),
305+
...builtInResolveExtensions,
306+
]),
307+
)
301308

302309
config.watchOptions = {
303310
ignored: /node_modules/,

0 commit comments

Comments
 (0)