-
Hey 👋, So, my config is following: const path = require('path');
const webpack = require('webpack');
module.exports = {
core: {
builder: 'webpack5',
},
framework: '@storybook/react',
features: {
babelModeV7: true,
},
stories: [
'../src/**/*.stories.mdx',
],
addons: [
'@storybook/addon-docs',
],
webpackFinal: async (config) => {
config.resolve = {
...config.resolve,
alias: {
...config.resolve.alias,
buffer: require.resolve('buffer'),
},
fallback: {
...config.resolve.fallback,
buffer: require.resolve('buffer'),
},
};
config.externals = {
...config.externals,
bufferutil: 'commonjs bufferutil',
'utf-8-validate': 'commonjs utf-8-validate',
};
// const filteredPlugins = config.plugins
// .filter((plugin) => plugin.constructor.name !== 'ProvidePlugin');
config.plugins = [
// ...filteredPlugins,
...config.plugins,
new webpack.ProvidePlugin({
process: require.resolve('process/browser.js'),
Buffer: ['buffer', 'Buffer'],
}),
];
return config;
},
}; In result I always get // console.log of definitions inside ProvidePlugin
DEFINITIONS {
process: '{ABS_PROJECT_PATH}/node_modules/process/browser.js'
} Could some1 explain me what I'm doing wrong or is it a bug in storybook? Thanks CC: @shilman |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I encountered the same problem. Eventually, I worked around it by leaving webpack's configuration alone and adding this to import { Buffer } from 'buffer';
global.Buffer = Buffer; |
Beta Was this translation helpful? Give feedback.
I encountered the same problem. Eventually, I worked around it by leaving webpack's configuration alone and adding this to
preview.tsx
: