From 53401f45ce802861ee42499b8f30e5d5baae702f Mon Sep 17 00:00:00 2001 From: Francesco Cesari Date: Fri, 13 Jun 2025 11:36:27 +0200 Subject: [PATCH 1/3] Fixes #145 Made it so that the plugin gets executed AFTER "esbuild", thus making namespaces no longer an issue of the plugin --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 17b71e6..1da04e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -185,7 +185,6 @@ export default function solidPlugin(options: Partial = {}): Plugin { return { name: 'solid', - enforce: 'pre', async config(userConfig, { command }) { // We inject the dev mode only if the user explicitly wants it or if we are in dev (serve) mode @@ -196,6 +195,10 @@ export default function solidPlugin(options: Partial = {}): Plugin { if (!userConfig.resolve) userConfig.resolve = {}; userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias); + // Forces "esbuild" to preserve JSX so that we can handle it here + // If "esbuild" is not being used I don't need to change anything + if (userConfig.esbuild) userConfig.esbuild.jsx ??= 'preserve'; + const solidPkgsConfig = await crawlFrameworkPkgs({ viteUserConfig: userConfig, root: projectRoot || process.cwd(), From fede2c0a799ae178c140c4db8be48dd5d4443480 Mon Sep 17 00:00:00 2001 From: Francesco Cesari Date: Fri, 13 Jun 2025 11:44:25 +0200 Subject: [PATCH 2/3] Added changeset --- .changeset/new-pears-explode.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/new-pears-explode.md diff --git a/.changeset/new-pears-explode.md b/.changeset/new-pears-explode.md new file mode 100644 index 0000000..181be96 --- /dev/null +++ b/.changeset/new-pears-explode.md @@ -0,0 +1,5 @@ +--- +'vite-plugin-solid': patch +--- + +Made it so that the plugin gets executed after "esbuild" From 461c9e0b38e6430b4c390a4fade6cc1914a4766d Mon Sep 17 00:00:00 2001 From: Sean Alunni Date: Thu, 19 Jun 2025 18:02:43 +0200 Subject: [PATCH 3/3] Fixed the bug that made "esbuild" emit React code if the user didn't provide `UserConfig.esbuild` --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 1da04e3..effbcd0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -196,8 +196,9 @@ export default function solidPlugin(options: Partial = {}): Plugin { userConfig.resolve.alias = normalizeAliases(userConfig.resolve && userConfig.resolve.alias); // Forces "esbuild" to preserve JSX so that we can handle it here - // If "esbuild" is not being used I don't need to change anything - if (userConfig.esbuild) userConfig.esbuild.jsx ??= 'preserve'; + // If "esbuild" is not being used, we don't need to change anything + if (userConfig.esbuild !== false) + userConfig.esbuild = { jsx: 'preserve', ...userConfig.esbuild }; const solidPkgsConfig = await crawlFrameworkPkgs({ viteUserConfig: userConfig,