storybook icon indicating copy to clipboard operation
storybook copied to clipboard

Build: Bundle lib/preview-web with ts-up

Open javier-arango opened this issue 2 years ago • 4 comments

Issue: #18732

What I did

Migrated lib/preview-web to use the ts-up bundler.

How to test

  • [ ] Is this testable with Jest or Chromatic screenshots?
  • [ ] Does this need a new example in the kitchen sink apps?
  • [ ] Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

javier-arango avatar Oct 02 '22 23:10 javier-arango

@javier-arango I pulled your branch and ran yarn bootstrap --build, and saw that preview-web was failing, with a message of:

src/PreviewWeb.tsx(65,3): error TS2612: Property 'previewEntryError' will overwrite the base property in 'Preview<TFramework>'. If this is intentional, add an initializer. Otherwise, add a 'declare' modifier or remove the redundant declaration.

So, I removed the duplicate previewEntryError, and was able to build successfully. Let's see what happens in CI 🤞.

IanVS avatar Oct 03 '22 00:10 IanVS

@IanVS Thank you for the help. Now I don't know why the lint check is failing. I am getting this error /tmp/storybook/code/lib/core-client/src/preview/start.test.ts 10:8 error Unexpected use of file extension "mockdata" for "@storybook/preview-web/dist/cjs/PreviewWeb.mockdata" import/extensions. Also, the unit-test is failing with this error Cannot find module '@storybook/preview-web/dist/cjs/WebView' from 'lib/core-client/src/preview/start.test.ts'. When I try to edit the import to @storybook/preview-web/dist/WebView and I try to commit it I get the same lint error. I don't know how to fix it.

javier-arango avatar Oct 03 '22 00:10 javier-arango

Both the linting error and the unit-test failures are correct.

in lib/core-client direct references are made to files deep in the dist folder of lib/preview-web. Moving the bundling breaks this.

We either have to expose multiple entrypoints, or update the usage in lib/core-client in some form.

ndelangen avatar Oct 05 '22 14:10 ndelangen

@IanVS I saw that you were helping with this issue too. Saw your changes, but we still failing the unit-test. I was trying to figure it out how to fix it, but I couldn't find a way to do it. In the mean time, I am going to try to help with a different package. Let me know if I should do something to help with this issue.

javier-arango avatar Oct 07 '22 08:10 javier-arango

@javier-arango I finally was able to get to this, but to not have to deal with merge conflicts I created a new branch off next branch. https://github.com/storybookjs/storybook/pull/19655

I'm sorry that I was not able to merge in your work, I really really appreciate the time, energy and skill you put into making this PR.

ndelangen avatar Oct 28 '22 12:10 ndelangen