Преглед изворни кода

fix(dashboard): Correct detection of tailwind classes in plugins

Michael Bromley пре 5 месеци
родитељ
комит
86da88ae2e
1 измењених фајлова са 20 додато и 4 уклоњено
  1. 20 4
      packages/dashboard/vite/vite-plugin-tailwind-source.ts

+ 20 - 4
packages/dashboard/vite/vite-plugin-tailwind-source.ts

@@ -27,10 +27,26 @@ export function dashboardTailwindSourcePlugin(): Plugin {
                 const { pluginInfo } = loadVendureConfigResult;
                 const dashboardExtensionDirs =
                     pluginInfo
-                        ?.map(
-                            ({ dashboardEntryPath, pluginPath }) =>
-                                dashboardEntryPath && path.join(pluginPath, path.dirname(dashboardEntryPath)),
-                        )
+                        ?.flatMap(({ dashboardEntryPath, sourcePluginPath, pluginPath }) => {
+                            if (!dashboardEntryPath) {
+                                return [];
+                            }
+                            const sourcePaths = [];
+                            if (sourcePluginPath) {
+                                sourcePaths.push(
+                                    path.join(
+                                        path.dirname(sourcePluginPath),
+                                        path.dirname(dashboardEntryPath),
+                                    ),
+                                );
+                            }
+                            if (pluginPath) {
+                                sourcePaths.push(
+                                    path.join(path.dirname(pluginPath), path.dirname(dashboardEntryPath)),
+                                );
+                            }
+                            return sourcePaths;
+                        })
                         .filter(x => x != null) ?? [];
                 const sources = dashboardExtensionDirs
                     .map(extension => {