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 production build breaks with use-lockfile-v6 #5976

Closed
mcmxcdev opened this issue Jan 24, 2023 · 5 comments · Fixed by #5998
Closed

storybook production build breaks with use-lockfile-v6 #5976

mcmxcdev opened this issue Jan 24, 2023 · 5 comments · Fixed by #5998

Comments

@mcmxcdev
Copy link
Contributor

pnpm version: 7.25.1

Code to reproduce the issue:

We recently updated to the new use-lockfile-v6 format and everything works fine except our storybook production build.

This is the stacktrace:

$ nx run zorro-ui-design:build-storybook               

> nx run zorro-ui-design:build-storybook


>  NX  ui framework: @storybook/react


>  NX  Storybook builder starting ...

info => Cleaning outputDir: /home/user/Webdevelopment/Freelancing/org/repo/dist/storybook/zorro-ui-design

 >  NX   Cannot copy `/home/user/Webdevelopment/Freelancing/org/repo/node_modules/.pnpm/@storybook+core-server@6.5.15(@storybook+builder-w_2rbwioi6ggwys4pddb257x4q6a/node_modules/@storybook/core-server/public/favicon.ico`: the file doesn't exist

   Pass --verbose to see the stacktrace.


 —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

 >  NX   Ran target build-storybook for project repo (8s)
 
    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

I have also reported this issue on storybookjs/storybook#20673 since I am not sure which repo has to make changes here to make it work.

Expected behavior:

Storybook production build should work same as before

Actual behavior:

The build runs into "file not found" issues with favicon.ico and then probably other files as well.

Additional information:

  • node -v prints: 18.12.1
  • Windows, macOS, or Linux?: Ubuntu 22.10
@zkochan
Copy link
Member

zkochan commented Jan 24, 2023

How to reproduce it?

@mcmxcdev
Copy link
Contributor Author

In the end I was able to upgrade to storybook v7 beta and there it works without a problem.

Anyways, since not everyone will be able to do that, I have created a minimal repo: https://github.com/mcmxcdev/pnpm-nx-storybook-issue

nx run ui-design:storybook will work while the nx run ui-design:build-storybook should be breaking with the error message in the original issue description.

@bvanjoi
Copy link
Contributor

bvanjoi commented Jan 29, 2023

error report:

image

reducing:

// package.json
{
  "dependencies": {
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "@storybook/builder-webpack5": "6.5.15",
    "@storybook/core-server": "6.5.15",
    "@storybook/manager-webpack5": "6.5.15"
  }
}

then pnpm i you will get following under node_modules/.pnpm:

image


It seems globby can't get expected result from source:

image

And with use-lockfile-v6=false, the result globby is correct, the problem may be caused by (.

image

@zkochan
Copy link
Member

zkochan commented Jan 29, 2023

I see 2 possible solutions. One is to replace () with []. It fixes storybook. But there's a chance that some other tool won't like it.

Another solution would be to escape () in directory names. For instance, replace them with + or _. We already use the these chars in these directories, so it should be OK. But it will be less readable.

@bvanjoi
Copy link
Contributor

bvanjoi commented Jan 30, 2023

I see 2 possible solutions. One is to replace () with []. It fixes storybook. But there's a chance that some other tool won't like it.

Another solution would be to escape () in directory names. For instance, replace them with + or _. We already use the these chars in these directories, so it should be OK. But it will be less readable.

I think _ is better. [] also used as glob syntax

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants