#global LOGLEVEL is undefined

2 messages · Page 1 of 1 (latest)

haughty mural
#

Been struggling to upgrade my app to webpack 5 and storybook 7. I am currently encountering an issue where a dependency in my project references a package called global and my app is not able to find it. Instead it aliases it to @storybook/global which is the wrong place.

ModuleNotFoundError: Module not found: Error: Can't resolve 'global/window' in '/.../node_modules/react-vis/es'
using description file: /.../node_modules/@storybook/channel-websocket/package.json (relative path: ./dist/esm)
    aliased with mapping 'global': '/.../.storybook/node_modules/global' to '.../.storybook/node_modules/global'
haughty mural
#

I managed to get a little further by adding a custom plugin to my webpack config, but now it seems like storybook is having issues accessing its own @storybook/global module?

index.js:10 Uncaught TypeError: Cannot read properties of undefined (reading 'LOGLEVEL')
    at ./node_modules/@storybook/channel-postmessage/node_modules/@storybook/client-logger/dist/esm/index.js (index.js:10:1)

// inside @storybook/client-logger/dist/esm/index.js
import global from 'global';
var LOGLEVEL = global.LOGLEVEL,

export 'default' (imported as 'global') was not found in 'global' (possible exports: global)./node_modules/@storybook/channel-websocket/node_modules/@storybook/client-logger/dist/esm/index.js 11:14-28