From f2c3e2bd02b3d354258eb07822ed2188b9a217d1 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 19 Nov 2026 11:10:25 +0800 Subject: [PATCH] fix: default the Solid compiler root to the Rspack context --- README.md | 4 +++- src/index.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ab7bbd..d6e63d1 100644 --- a/README.md +++ b/README.md @@ -116,7 +116,9 @@ export default { ### solid -Pass options to the selected Solid compiler through `solid`. It generates DOM output by default and enables development transforms in Rspack’s development mode. For a server build that renders HTML for hydration, use the following settings. +Pass options to the selected Solid compiler through `solid`. It generates DOM output by default and enables development transforms in Rspack’s development mode. Source locations are relative to Rspack’s `context` by default. Set `solid.root` to use a different base directory. + +For a server build that renders HTML for hydration, use the following settings. ```ts export default { diff --git a/src/index.ts b/src/index.ts index f8bd552..c8263c2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,7 +42,11 @@ const solidLoader: LoaderDefinition = async function ( const filename = getTransformFilename(resourceFilename); const { compiler = 'native', decoratorVersion } = options; - const solid = { dev: this.mode === 'development', ...options.solid }; + const solid = { + dev: this.mode === 'development', + ...options.solid, + root: options.solid?.root ?? this.rootContext, + }; const refresh = options.refresh ?? (this.mode === 'development' &&