ReactLibraries / storybook-addon-module-mock

Provides module mocking functionality like jest.mock on Storybook.
MIT License
42 stars 5 forks source link

TypeError: (0 , _clamp.default) is not a function #15

Open TakumaNawata opened 7 months ago

TakumaNawata commented 7 months ago

Hello, thank you for your great work in advance. I am using "storybook-addon-module-mock" with "@mui/material" version "5.15.11", an error will occur on storybook. However, this error did not occur on "5.15.10" or lower. Do you have any ideas or solutions when using it with "5.15.11" or higher? The details of the version and error are below. Thank you.

version:

"storybook": "7.6.17"
"storybook-addon-module-mock": "1.1.5"
"@mui/material": "5.15.11"

error:

TypeError: (0 , _clamp.default) is not a function
    at clampWrapper (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:32784:29)
    at lighten (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:33051:17)
    at addLightOrDark (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:29525:91)
    at augmentColor (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:29674:5)
    at createPalette (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:29697:14)
    at createTheme (http://localhost:6006/vendors-node_modules_babel_runtime_helpers_esm_asyncToGenerator_js-node_modules_babel_runtime-9da363.iframe.bundle.js:29800:77)
    at ./src/common/lib/mui/theme.ts (http://localhost:6006/main.iframe.bundle.js:22595:70)
    at __webpack_require__ (http://localhost:6006/runtime~main.iframe.bundle.js:28:33)
    at fn (http://localhost:6006/runtime~main.iframe.bundle.js:321:21)
    at ./src/common/lib/mui/index.ts (http://localhost:6006/main.iframe.bundle.js:22572:64)
error_image
Demianeen commented 1 month ago

Have you tried to add exclude option in main.ts for the storybook-addon-module-mock plugin? For example like this:

{
    name: 'storybook-addon-module-mock',
    options: {
        exclude: ['**/node_modules/@mui/**'],
    },
},