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

storybook can't resolve paths to other libraries #7966

Closed
admir86 opened this issue Dec 2, 2021 · 3 comments · Fixed by #7917
Closed

storybook can't resolve paths to other libraries #7966

admir86 opened this issue Dec 2, 2021 · 3 comments · Fixed by #7917
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug

Comments

@admir86
Copy link

admir86 commented Dec 2, 2021

Current Behavior

Importing a module from lib x into a story of lib y does not work.
Storybook crashes with ModuleNotFoundError: Module not found: Error: Can't resolve '@inova-test/common' in 'C:\Users\admir\source\repos\inova-test\libs\desktop\src\lib\navigation'

Expected Behavior

It worked before upgrading to v13. Should work like in v12.

Steps to Reproduce

I created a new workspace with 2 libraries, added storybook to both and tried to use a component from the common library in a story in the desktop library.
Clone this repo: https://github.com/admir86/inova-test and run npx nx run desktop:storybook

Failure Logs

ModuleNotFoundError: Module not found: Error: Can't resolve '@inova-test/common' in 'C:\Users\admir\source\repos\inova-test\libs\desktop\src\lib\navigation'
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\Compilation.js:2011:28
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:795:13
    at eval (eval at create (C:\Users\admir\source\repos\inova-test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:10:1)
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:275:22
    at eval (eval at create (C:\Users\admir\source\repos\inova-test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:9:1)
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:431:22
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:124:11
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:667:25
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:852:8
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:972:5
    at C:\Users\admir\source\repos\inova-test\node_modules\neo-async\async.js:6883:13
    at C:\Users\admir\source\repos\inova-test\node_modules\webpack\lib\NormalModuleFactory.js:955:45
    at finishWithoutResolve (C:\Users\admir\source\repos\inova-test\node_modules\enhanced-resolve\lib\Resolver.js:296:11)
    at C:\Users\admir\source\repos\inova-test\node_modules\enhanced-resolve\lib\Resolver.js:362:15
    at C:\Users\admir\source\repos\inova-test\node_modules\enhanced-resolve\lib\Resolver.js:410:5
    at eval (eval at create (C:\Users\admir\source\repos\inova-test\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:16:1)

Environment

Node : 16.10.0
  OS   : win32 x64
  npm  : 7.24.1

  nx : 13.2.3
  @nrwl/angular : 13.2.3
  @nrwl/cli : 13.2.3
  @nrwl/cypress : 13.2.3
  @nrwl/devkit : 13.2.3
  @nrwl/eslint-plugin-nx : 13.2.3
  @nrwl/express : undefined
  @nrwl/jest : 13.2.3
  @nrwl/linter : 13.2.3
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : undefined
  @nrwl/react : undefined
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.2.3
  @nrwl/web : undefined
  @nrwl/workspace : 13.2.3
  @nrwl/storybook : 13.2.3
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 7.4.0
  ---------------------------------------
  Community plugins:
         @angular/animations: 13.0.2
         @angular/common: 13.0.2
         @angular/compiler: 13.0.2
         @angular/core: 13.0.2
         @angular/forms: 13.0.2
         @angular/platform-browser: 13.0.2
         @angular/platform-browser-dynamic: 13.0.2
         @angular/router: 13.0.2
         @angular-devkit/build-angular: 13.0.3
         @angular/cli: 13.0.3
         @angular/compiler-cli: 13.0.2
         @angular/language-service: 13.0.2
         @storybook/angular: 6.4.0

(node:25872) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./" in the "exports" field module resolution of the package at C:\Users\admir\source\repos\inova-test\node_modules\tslib\package.json.
Update this package.json to use a subpath pattern like "./*".
(Use `node --trace-deprecation ...` to show where the warning was created)
@nikbabchenko
Copy link

most likely related to the following storybookjs/storybook#16882

@AgentEnder AgentEnder added the scope: storybook Issues related to Storybook support in Nx label Dec 3, 2021
@juristr juristr self-assigned this Dec 6, 2021
@juristr
Copy link
Member

juristr commented Dec 6, 2021

Thanks for reporting. I'm closing this as it is a duplicate of #7966. Let's track the issue there 🙂

@juristr juristr closed this as completed Dec 6, 2021
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants