storybook: [Bug]: `@storybook/theming/create` export no longer exists with 8.2.2

Describe the bug

I’m upgrading our Storybook from 8.1 to 8.2.2 and ran into the error below:

1:17:48 PM [vite] Internal server error: Failed to resolve import "@storybook/theming/create" from ".storybook/sl-theme.ts". Does the file exist?

Code in question: import { create } from '@storybook/theming/create';

Afaict this code should still be valid (https://storybook.js.org/docs/configure/user-interface/theming#create-a-theme-quickstart)

If i inspect the theming package in my node_modules folder, i don’t see anything anymore that relates to create.

Reproduction link

Reproduction steps

No response

System

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.15.1 - /opt/homebrew/bin/node
    Yarn: 4.3.1 - /opt/homebrew/bin/yarn <----- active
    npm: 10.7.0 - /opt/homebrew/bin/npm
  Browsers:
    Chrome: 126.0.6478.127
    Safari: 17.5
  npmPackages:
    @storybook/addon-a11y: ^8.2.2 => 8.2.2 
    @storybook/addon-essentials: ^8.2.2 => 8.2.2 
    @storybook/addon-storysource: ^8.2.2 => 8.2.2 
    @storybook/core-events: ^8.2.2 => 8.2.2 
    @storybook/manager-api: ^8.2.2 => 8.2.2 
    @storybook/preview-api: ^8.2.2 => 8.2.2 
    @storybook/test: ^8.2.2 => 8.2.2 
    @storybook/theming: ^8.2.2 => 8.2.2 
    @storybook/web-components-vite: ^8.2.2 => 8.2.2 
    chromatic: ^11.5.5 => 11.5.5 
    storybook: ^8.2.2 => 8.2.2

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 26 (17 by maintainers)

Most upvoted comments

I think there’s something slightly different going on with PNPM workspaces as well.

Getting the same create not exported error, but I have @storybook/theming installed in this package.

FYI, we are looking into writing an automigration to look for these packages that are referenced in code but not available in package.json and add those dev dependencies automatically. Hopefully this will save a lot of pain for all the users who have yet to upgrade to 8.2.

The bot’s statement is false. I’ll investigate.

Hey all, a fix has been released in 8.3.0-alpha.2. Can you see if your issues are resolved? We will also patch this back to 8.2.5 shortly.

Hi @vanessayuenn, I checked and the issue has been fixed (at least for me). Thank you very much.

I see… the issue you seem to get is this:

@orbitkit/storybook:build
cache miss, executing 63e832f9b940368b
$ tsc -p tsconfig.build.json
src/preview.tsx:49:7 - error TS4023: Exported variable 'preview' has or is using name 'ThemeVars' from external module "/home/runner/work/orbitkit/orbitkit/node_modules/@storybook/core/dist/theming/create" but cannot be named.

49 const preview = {
         ~~~~~~~

src/theme.ts:4:1 - error TS4082: Default export of the module has or is using private name 'ThemeVars'.

  4 export default create({
    ~~~~~~~~~~~~~~~~~~~~~~~
  5   base: 'dark',
    ~~~~~~~~~~~~~~~
... 
 27   textInverseColor: grayDark.gray1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 28 })

@ixahmedxi?

Is this a problem with our types?

I’ve seen the “but cannot be named” problem often too, and always end up here: https://stackoverflow.com/questions/43900035/ts4023-exported-variable-x-has-or-is-using-name-y-from-external-module-but

We do export the ThemeVars type here:

https://github.com/storybookjs/storybook/blob/4ba799f0e44ef6c0365a3b306f8ffe2ee2db4ace/code/core/src/theming/types.ts#L5

re-exported here: https://github.com/storybookjs/storybook/blob/c6472602bcc3bbb654653037c62bd87495bfb153/code/core/src/theming/index.ts#L32

So I’m not sure there’s anything on the storybook side we could do, but I’m very open to suggests and would love to fix this so no changes are required on your part.

I can’t seem to be able to import ThemeVars from @storybook/theming/create but I can from @storybook/core/theming or @storybook/theming.

The error actually goes away when I import the create function from @storybook/core/theming or @storybook/theming instead of @storybook/theming/create.