storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
886 stars 109 forks source link

[Bug] Trying to import modules breaks tests #522

Closed AthulMuralidhar closed 1 year ago

AthulMuralidhar commented 1 year ago

What version of vite are you using?

3.1.4

System info and storybook versions

Environment Info: System: OS: Linux 6.0 NixOS 22.05 (Quokka) 22.05 (Quokka) CPU: (16) x64 AMD Ryzen 7 PRO 5850U with Radeon Graphics Binaries: Node: 18.9.1 - /nix/store/zvl9fx0mcjrkyy1frxsq86j2gxxrr2qa-nodejs-18.9.1/bin/node Yarn: 1.22.18 - /nix/store/6vm0f48krwxnl6mmi5rh47r97kmxwhng-yarn-1.22.18/bin/yarn npm: 8.19.1 - /nix/store/zvl9fx0mcjrkyy1frxsq86j2gxxrr2qa-nodejs-18.9.1/bin/npm Browsers: Firefox: 106.0.5 npmPackages: @storybook/addon-actions: ^6.5.13 => 6.5.13 @storybook/addon-coverage: ^0.0.5 => 0.0.5 @storybook/addon-essentials: ^6.5.13 => 6.5.13 @storybook/addon-interactions: ^6.5.13 => 6.5.13 @storybook/addon-links: ^6.5.13 => 6.5.13 @storybook/builder-vite: ^0.2.5 => 0.2.5 @storybook/jest: ^0.0.10 => 0.0.10 @storybook/test-runner: ^0.9.0 => 0.9.0 @storybook/testing-library: ^0.0.13 => 0.0.13 @storybook/vue3: ^6.5.13 => 6.5.13

Describe the Bug

so we have a bunch of tests that use storybook and vite - while running the tests we have this error from the storybook webapp:

Cannot read properties of undefined (reading 'length')
    at memoizedBinarySearch (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:9959:25)
    at traceSegmentInternal (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:10062:17)
    at originalPositionFor$1 (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:10049:25)
    at formatError (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:40916:54)
    at TransformContext.error (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:40850:19)
    at Object.transform (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:41106:25)
    at async loadAndTransform (file:///home/athul/testproject/node_modules/vite/dist/node/chunks/dep-6b3a5aff.js:37365:29

Link to Minimal Reproducible Example

No response

Participation

IanVS commented 1 year ago

Sorry, without a reproduction or some more details, we won't be able to help much.

AthulMuralidhar commented 1 year ago

(tried to add more info, but couldn't for some reason)

AthulMuralidhar commented 1 year ago

@IanVS fair enough :)

IanVS commented 1 year ago

Are you trying to upgrade to 7.0? And what module are you trying to import? Maybe you can share some of your code?

AthulMuralidhar commented 1 year ago

yes, i'm working on trying to make a minimal reproducible example - but to answer your question: not really no - not trying to upgrade to 7.0

AthulMuralidhar commented 1 year ago

closing issue due to fix being found :) thanks!