From e553aab7a503d8b41497d01f01ebd10b3cce11af Mon Sep 17 00:00:00 2001 From: Nikhil Saraf Date: Sat, 30 Dec 2023 12:56:45 +0530 Subject: [PATCH] allow sending plugins fn (to get different instances for each router) no other way of cloning plugins without their scope right now --- packages/start/config/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/start/config/index.js b/packages/start/config/index.js index 77b95bcf4..bdef6f6c1 100644 --- a/packages/start/config/index.js +++ b/packages/start/config/index.js @@ -80,9 +80,10 @@ export function defineConfig(baseConfig = {}) { routes: solidStartServerFsRouter({ dir: `${start.appRoot}/routes`, extensions }), extensions, target: "server", - plugins: () => [ + plugins: async () => [ config("user", userConfig), - ...plugins, + ...(typeof plugins === "function" ? [...(await plugins())] : plugins), + serverTransform({ runtime: normalize(fileURLToPath(new URL("./server-fns-runtime.jsx", import.meta.url))) }), @@ -121,9 +122,9 @@ export function defineConfig(baseConfig = {}) { }), extensions, target: "browser", - plugins: () => [ + plugins: async () => [ config("user", userConfig), - ...plugins, + ...(typeof plugins === "function" ? [...(await plugins())] : plugins), serverFunctions.client({ runtime: normalize(fileURLToPath(new URL("./server-runtime.jsx", import.meta.url))) }), @@ -161,9 +162,10 @@ export function defineConfig(baseConfig = {}) { handler: normalize(fileURLToPath(new URL("./server-handler.js", import.meta.url))), runtime: normalize(fileURLToPath(new URL("./server-fns-runtime.jsx", import.meta.url))), // routes: solidStartServerFsRouter({ dir: `${start.appRoot}/routes`, extensions }), - plugins: () => [ + plugins: async () => [ config("user", userConfig), - ...plugins, + ...(typeof plugins === "function" ? [...(await plugins())] : plugins), + solid({ ...start.solid, ssr: true, extensions: extensions.map(ext => `.${ext}`) }), config("app-server", { resolve: {