Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The requested module '/@fs/.../node_modules/lodash/<anyFunction>.js' does not provide an export named 'default' #21527

Closed
thtliife opened this issue Mar 10, 2023 · 5 comments · Fixed by #21532

Comments

@thtliife
Copy link
Contributor

Describe the bug

SyntaxError: The requested module '/@fs/Users/vito/repos/personal/demo-storybook/node_modules/lodash/mapValues.js?v=fae03021' does not provide an export named 'default'

This issue occurs in storybook 7.0.0-rc.0

To Reproduce

Clone the next branch from storybookjs/storybook and run yarn start

Observe results
sb error

System

Environment Info:

  System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M1
  Binaries:
    Node: 19.7.0 - ~/.tools/n/bin/node
    Yarn: 3.4.1 - ~/.tools/n/bin/yarn
    npm: 9.5.0 - ~/.tools/n/bin/npm
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 110.0.1
    Safari: 16.2

Additional context

No response

@thtliife thtliife changed the title [Bug]: [Bug]: The requested module '/@fs/.../node_modules/lodash/<anyFunction>.js?v=fae03021' does not provide an export named 'default' Mar 10, 2023
@thtliife thtliife changed the title [Bug]: The requested module '/@fs/.../node_modules/lodash/<anyFunction>.js?v=fae03021' does not provide an export named 'default' [Bug]: The requested module '/@fs/.../node_modules/lodash/<anyFunction>.js' does not provide an export named 'default' Mar 10, 2023
@thtliife
Copy link
Contributor Author

thtliife commented Mar 10, 2023

This issue can be worked around via the use of the vite configs optimizeDeps option in .storybook/main.ts
eg:

export const viteFinal = async (config: InlineConfig) =>
  mergeConfig(config, {
    optimizeDeps: {
      include: [
        'lodash/camelCase.js',
        'lodash/cloneDeep.js',
        'lodash/countBy.js',
        'lodash/debounce.js',
        'lodash/isEqual.js',
        'lodash/isFunction.js',
        'lodash/isPlainObject.js',
        'lodash/isString.js',
        'lodash/kebabCase.js',
        'lodash/mapKeys.js',
        'lodash/mapValues.js',
        'lodash/merge.js',
        'lodash/mergeWith.js',
        'lodash/pick.js',
        'lodash/pickBy.js',
        'lodash/startCase.js',
        'lodash/throttle.js',
        'lodash/uniq.js',
        'lodash/upperFirst.js'
      ]
    }
  });

This is also a similar issue to #21523, I wonder whether adding 'doctrine' to the include array may help there too?

@shilman
Copy link
Member

shilman commented Mar 10, 2023

This looks like a problem with node 19. We should fix before GA

@D1no
Copy link

D1no commented Mar 10, 2023

@shilman No it's a regression from beta-63 to rc.0 on node 18 LTS

#21523 (comment)

@shilman
Copy link
Member

shilman commented Mar 10, 2023

Aha good catch. Will try to get this fixed today!

@shilman
Copy link
Member

shilman commented Mar 10, 2023

Shiver me timbers!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-rc.1 containing PR #21532 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

D1no added a commit to D1no/reproduction-storybook-symlinks-pnpm that referenced this issue Mar 12, 2023
…upgrade --prerelease --skip-check`, fixes `rc.0` doctrine regression

storybookjs/storybook#21399
FIXES storybookjs/storybook#21523
FIXES storybookjs/storybook#21527

Console: 
```bash
➜  tools git:(master) ✗ pnpx storybook@next upgrade --prerelease --skip-check
.../Library/pnpm/store/v3/tmp/dlx-97337  | +603 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.../Library/pnpm/store/v3/tmp/dlx-97337  | Progress: resolved 624, reused 581, downloaded 22, added 603, done
 • Checking for latest versions of '@storybook/*' packagesinfo ,Using pnpm
info Upgrading /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/package.json
info 
info  @storybook/addon-essentials    ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/addon-interactions  ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/addon-links         ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/blocks              ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/react               ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/react-vite          ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  storybook                      ^7.0.0-beta.63  →  ^7.0.0-rc.1
info 
info Run pnpm install to install new versions.
info ,
info 
info ,Using pnpm
info Upgrading /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/package.json
info 
info No dependencies.
info ,
 • Installing upgrades • Preparing to install dependencies. ✓


Packages: +809
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/worker/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 830, reused 781, downloaded 28, added 809, done

dependencies:
+ react 18.2.0
+ react-dom 18.2.0

devDependencies:
+ @storybook/addon-essentials 7.0.0-rc.1
+ @storybook/addon-interactions 7.0.0-rc.1
+ @storybook/addon-links 7.0.0-rc.1
+ @storybook/blocks 7.0.0-rc.1
+ @storybook/react 7.0.0-rc.1
+ @storybook/react-vite 7.0.0-rc.1
+ @storybook/testing-library 0.0.14-next.1
+ @types/react 18.0.28
+ @types/react-dom 18.0.11
+ prop-types 15.8.1
+ storybook 7.0.0-rc.1
+ typescript 4.9.5
+ vite 4.1.4

The integrity of 1217 files was checked. This might have caused installation to take longer.
Done in 16.2s
. ✓

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

➜  tools git:(master) ✗ pnpm run storybook                                   

> tools@ storybook /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools
> storybook dev -p 6006

@storybook/cli v7.0.0-rc.1

info => Starting manager..
WARN No story files found for the specified pattern: stories/**/*.mdx
╭──────────────────────────────────────────────────────╮
│                                                      │
│   Storybook 7.0.0-rc.1 for react-vite started        │
│   127 ms for manager and 1.79 s for preview          │
│                                                      │
│    Local:            http://localhost:6006/          │
│    On your network:  http://192.168.178.102:6006/    │
│                                                      │
╰──────────────────────────────────────────────────────╯
```
D1no added a commit to D1no/reproduction-storybook-symlinks-pnpm that referenced this issue Mar 12, 2023
…upgrade --prerelease --skip-check`, fixes `rc.0` doctrine regression

storybookjs/storybook#21399
FIXES storybookjs/storybook#21523
FIXES storybookjs/storybook#21527

Console: 
```bash
➜  tools git:(master) ✗ pnpx storybook@next upgrade --prerelease --skip-check
.../Library/pnpm/store/v3/tmp/dlx-97337  | +603 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.../Library/pnpm/store/v3/tmp/dlx-97337  | Progress: resolved 624, reused 581, downloaded 22, added 603, done
 • Checking for latest versions of '@storybook/*' packagesinfo ,Using pnpm
info Upgrading /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/package.json
info 
info  @storybook/addon-essentials    ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/addon-interactions  ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/addon-links         ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/blocks              ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/react               ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  @storybook/react-vite          ^7.0.0-beta.63  →  ^7.0.0-rc.1
info  storybook                      ^7.0.0-beta.63  →  ^7.0.0-rc.1
info 
info Run pnpm install to install new versions.
info ,
info 
info ,Using pnpm
info Upgrading /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools/package.json
info 
info No dependencies.
info ,
 • Installing upgrades • Preparing to install dependencies. ✓


Packages: +809
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/worker/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
Progress: resolved 830, reused 781, downloaded 28, added 809, done

dependencies:
+ react 18.2.0
+ react-dom 18.2.0

devDependencies:
+ @storybook/addon-essentials 7.0.0-rc.1
+ @storybook/addon-interactions 7.0.0-rc.1
+ @storybook/addon-links 7.0.0-rc.1
+ @storybook/blocks 7.0.0-rc.1
+ @storybook/react 7.0.0-rc.1
+ @storybook/react-vite 7.0.0-rc.1
+ @storybook/testing-library 0.0.14-next.1
+ @types/react 18.0.28
+ @types/react-dom 18.0.11
+ prop-types 15.8.1
+ storybook 7.0.0-rc.1
+ typescript 4.9.5
+ vite 4.1.4

The integrity of 1217 files was checked. This might have caused installation to take longer.
Done in 16.2s
. ✓

attention => Storybook now collects completely anonymous telemetry regarding usage.
This information is used to shape Storybook's roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://storybook.js.org/telemetry

➜  tools git:(master) ✗ pnpm run storybook                                   

> tools@ storybook /Users/worker/development/_REPRODUCTIONS/reproduction-storybook-symlinks-pnpm/tools
> storybook dev -p 6006

@storybook/cli v7.0.0-rc.1

info => Starting manager..
WARN No story files found for the specified pattern: stories/**/*.mdx
╭──────────────────────────────────────────────────────╮
│                                                      │
│   Storybook 7.0.0-rc.1 for react-vite started        │
│   127 ms for manager and 1.79 s for preview          │
│                                                      │
│    Local:            http://localhost:6006/          │
│    On your network:  http://192.168.178.102:6006/    │
│                                                      │
╰──────────────────────────────────────────────────────╯
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
4 participants