Skip to content

Commit

Permalink
Merge branch 'main' into renovate/cypress-9.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jtoar authored May 24, 2022
2 parents f8e267a + b2c2fd7 commit bd8bfa9
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 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, mergeWithCustomize } = require('webpack-merge')
const { mergeWithCustomize } = require('webpack-merge')

const { getSharedPlugins } = require('@redwoodjs/core/config/webpack.common.js')
const {
Expand All @@ -16,29 +16,6 @@ const rwjsPaths = getPaths()

const staticAssetsFolder = path.join(getPaths().web.base, 'public')

function isPackageInstalled(alias) {
try {
return Boolean(require(alias))
} catch (e) {
return false
}
}

function withEmotionVersionFallback(config) {
const alias = Object.entries({
'@emotion/core': '@emotion/core',
'@emotion/styled': '@emotion/styled',
'emotion-theming': '@emotion/react',
}).reduce((acc, [packageName, alias]) => {
if (isPackageInstalled(alias)) {
acc[packageName] = require.resolve(alias)
}
return acc
}, {})

return merge(config, { resolve: { alias } })
}

const baseConfig = {
core: {
builder: 'webpack5',
Expand Down Expand Up @@ -135,8 +112,6 @@ const baseConfig = {
// https://webpack.js.org/guides/build-performance/#output-without-path-info
sbConfig.output.pathinfo = false

sbConfig = withEmotionVersionFallback(sbConfig)

return sbConfig
},
// only set staticDirs when running Storybook process; will fail if set for SB --build
Expand Down

0 comments on commit bd8bfa9

Please sign in to comment.