Skip to content

Commit

Permalink
Fix: dedupe addons when merging storybook main config (#5592)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar authored May 20, 2022
1 parent 89f5555 commit 091c7d3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/testing/config/storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs')
const path = require('path')

const { merge } = require('webpack-merge')
const { merge, mergeWithCustomize } = require('webpack-merge')

const { getSharedPlugins } = require('@redwoodjs/core/config/webpack.common.js')
const {
Expand Down Expand Up @@ -154,7 +154,14 @@ const mergeUserStorybookConfig = (baseConfig) => {
}

const userStorybookConfig = require(redwoodPaths.web.storybookConfig)
return merge(baseConfig, userStorybookConfig)

return mergeWithCustomize({
customizeArray(baseConfig, userStorybookConfig, key) {
if (key === 'addons') {
return [...new Set([...baseConfig, ...userStorybookConfig])]
}
},
})(baseConfig, userStorybookConfig)
}

/** @returns {import('webpack').Configuration} Webpack Configuration with storybook config */
Expand Down

0 comments on commit 091c7d3

Please sign in to comment.