-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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]: 7.0.0-rc.8 Cannot find module 'lib/types/dist' in @storybook/html #21820
Comments
# Pull Request ## 🤨 Rationale We want to be on the latest storybook version because it fixes issues we've had with dependencies and it enables more powerful docs pages via mdx and Component Story Format enhancements. Notable changes: - landing page uses correct fonts and errors in console are gone (fixing #825 and #943 properly) - [no more Docs tab](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#70-docs-changes). Each story group has a docs page under it instead. - XD previews are gone (feature was deprecated) - Actions not working yet and some code previews have stopped working; see "Follow ups" below ## 👩💻 Implementation Following the [upgrade guide](https://storybook.js.org/docs/react/configure/upgrading#prereleases) didn't work very well because it is buggy with a monorepo. Fred's general strategy was to run the upgrade command from within `nimble-components` then delete the `node_modules` and `package-lock.json` that it creates there, then re-install everything from the root. The migration tool is responsible for the changes to: 1. storybook configuration files 2. package.json 3. renaming types like `Story` -> `StoryFn` and `storyName` to `name` 4. deleting the `withXD` decorator which is no longer supported Beyond that there were a few other manual changes: 1. establish static dependencies on components needed by each story. Storybook seems to have gotten more aggressive about compiling away unneeded components so if something isn't imported, it won't be found and components won't render correctly. This meant: 1. replacing a few literals for element tag names in stories with the `elementTag` export 2. updating the `nimble-menu` to explicitly depend on `nimble-anchored-region` (see comment on `menu/index.ts`) 2. Enable 'autodocs' for component and token stories but disable it for test stories 3. Add a patch file to work around storybookjs/storybook#21820 4. simplified return types of story generation functions in `storybook.ts` in response to storybook type changes 5. regenerated landing page screenshot and annotation now that docs tab is gone ## 🔜 Follow ups in future PRs Fixing these issues is tracked by #1146 . I tried upgrading to ts 4.7 but it didn't fix any of them. - [ ] storybookjs/storybook#21820 - [ ] Figure out why actions aren't firing when you click a button. Likely [need this decorator](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#removed-auto-injection-of-storybookaddon-actions-decorator) but it's not present in current rc: storybookjs/storybook#21308 - [ ] Some code previews (table, tooltip) are not available in the Docs page ## 🧪 Testing Chromatic caught several diffs which resulted in the manual changes described above 👍. ~~It's still showing new stories for the wafer map and button. (The wafer map one is caused by Chromatic getting confused when I tried renaming that story, ran a Chromatic build, and then reverted that change. I don't know the cause of the button change.)~~ <- this went away on a subsequent build Also manually spot checked many of the stories across browsers, especially ones that have workarounds in them like table and theme-aware tokens. ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [x] I have updated the project documentation to reflect my changes or determined no changes are needed. --------- Co-authored-by: Fred Visser <[email protected]>
Still seeing this issue with v7.0.2. |
I've starting seeing an additional related error in 7.0.4:
The workaround we've adopted is to use patch-package to run during |
# Pull Request ## 🤨 Rationale Right after I submitted the upgrade to a release candidate of Storybook 7 in #1134, I noticed they [released the official 7.0.0](https://github.com/storybookjs/storybook/releases). Adopting the latest patch addresses some of the issues in #1146. ## 👩💻 Implementation 1. Update to latest non-RC build in package.json and regenerate package-lock.json 2. Regenerate one patch file since the file it was patching has a new name 3. Add another patch file since they introduced another instance of storybookjs/storybook#21820 4. Move off deprecated API for specifying `sourceTransform` as described in [migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#source-block) 5. Delete `storybook-declarations.ts` since this bug was closed storybookjs/storybook#21887 ## 🧪 Testing Explored Storybook. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
@ndelangen do you have any idea where this broken type declaration comes from ? The source code in the repo does not use |
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.8 containing PR #22175 that references this issue. Upgrade today to the
|
Yee-haw!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.7 containing PR #22175 that references this issue. Upgrade today to the
|
Thank you! |
@ndelangen I tried upgrading to 7.0.7 and I still see these same two errors. And on unpkg you can see that the
I also started seeing new errors when trying to use the
|
@jattasNI thank you for reporting back and showing what's wrong! I have investigated and concluded there is indeed a bug somewhere in the tooling generating the definitions file. I think I found a way around the issue. |
Jiminy cricket!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.12 containing PR #22261 that references this issue. Upgrade today to the
|
Yippee!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.8 containing PR #22261 that references this issue. Upgrade today to the
|
Describe the bug
In Storybook 7.0.0-rc.8 I see a TypeScript compile error when I try to build a project that imports types from
@storybook/html
:(There is a similar issue with
import * as lib_docs_tools_dist from 'lib/docs-tools/dist';
)If I look in
node_modules
I don't see any directory forlib
or any entry points namedlib
inpackage.json
. Are these standard ES module imports? Is a certain bundler configuration required for this import to be found? If I locally modifynode_modules/@storybook/html/dist/types-2ec88714.d.ts
as described below, the build succeeds.import * as lib_types_dist from 'lib/docs-tools/dist';
change toimport * as lib_types_dist from '@storybook/docs-tools';
To Reproduce
Currently failing the build in this branch of the ni/nimble repository. To build, clone that branch then run
npm i
andnpm run build
. The build for/packages/nimble-components
will fail with this error.If a smaller reproduction case would be helpful I can try to create one.
System
Additional context
A workaround is to change
tsconfig.json
to include"skipLibCheck": true
, which tells the TypeScript compiler not to run type checking on code innode_modules
. But that impacts compile for all dependencies so we'd prefer not to have to do this.The text was updated successfully, but these errors were encountered: