Skip to content

Commit

Permalink
(migration) resolve the error 'UnhandledSchemeError' for node: prefix…
Browse files Browse the repository at this point in the history
  • Loading branch information
nozomione committed Aug 9, 2023
1 parent 9138bdf commit 6800a6d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as path from 'path'

export default {
stories: ['./stories/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
stories: ['./stories/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-a11y',
'@storybook/addon-links',
Expand All @@ -19,15 +19,21 @@ export default {
docs: {
autodocs: true
},
webpackFinal: async (config) => {
webpackFinal: async (config, { presets }) => {
// (resource) 'configType' https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config

const webpack = await presets.apply('webpackInstance')
config.resolve.modules.push(path.resolve(__dirname, './../src'))
config.resolve.alias['utils'] = path.resolve(__dirname, './utils')
config.resolve.alias['unfetch'] = path.resolve(
__dirname,
'./../node_modules/unfetch/dist/unfetch.mjs'
)
config.plugins.push(
new webpack.NormalModuleReplacementPlugin(/^node:/, (resource) => {
resource.request = resource.request.replace(/^node:/, '')
})
)

// Return the altered config
return config
}
Expand Down

0 comments on commit 6800a6d

Please sign in to comment.