Skip to content

Commit

Permalink
fix: plugins not loading properly
Browse files Browse the repository at this point in the history
  • Loading branch information
ubermanu committed Jul 19, 2023
1 parent fd9c1b4 commit 8261d35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/actions/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const build = async (themeName: string, locale = 'en_US') => {
const dest = path.join(themeConfig.dest, locale)
for (const plugin of themeConfig.plugins) {
try {
// @ts-ignore
await plugin({
...themeConfig,
dest,
Expand Down
12 changes: 9 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,23 @@ export const getThemeConfig = memo(async (themeName: string) => {
}
}

const pluginList: Plugin[] | string[] = []
const pluginList: Array<Plugin | string | [string, any]> = []

// Add the preset plugins to the plugin list
if (userConfig.presets) {
const presets = await Promise.all(userConfig.presets.map(transformPresetDefinition))
presets.forEach((preset) => {
// @ts-ignore
pluginList.push(...preset.plugins)
if (Array.isArray(preset.plugins)) {
preset.plugins.forEach((plugin) => pluginList.push(plugin))
}
})
}

// Add the user plugins to the plugin list
if (userConfig.plugins) {
userConfig.plugins.forEach((plugin) => pluginList.push(plugin))
}

// Add support for multiple plugin formats
// It can be 'string', 'object' or 'function'
const plugins = await Promise.all(pluginList.map(transformPluginDefinition))
Expand Down

0 comments on commit 8261d35

Please sign in to comment.