[Bug]: Storybook 7.0.0 to 7.1.0 - TypeScript warnings for @storybook/angular framework
nstuyvesant opened this issue · 15 comments
Describe the bug
I am using Storybook 7.0.0-rc.4 with Angular 14.2. In the tsconfig.json for Storybook, I forgot to set compilerOptions.skipLibCheck to false and it reported these warnings...
info => Preview built (30 s)
WARN export 'default' (imported as 'previewAnnotations') was not found in '/Users/xyz/dev/carbon-charts/node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs' (possible exports: highlightObject, highlightStyle)
WARN export 'default' (imported as 'previewAnnotations') was not found in '/Users/xyz/dev/carbon-charts/node_modules/@storybook/angular/dist/client/config.js' (possible exports: __esModule, applyDecorators, parameters, render, renderToCanvas)
WARN export 'default' (imported as 'previewAnnotations') was not found in '/Users/xyz/dev/carbon-charts/node_modules/@storybook/angular/dist/client/docs/config' (possible exports: __esModule, argTypesEnhancers, decorators, parameters)
The build proceeded without problems but I thought I'd report this.
To Reproduce
No response
System
Environment Info:
System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 18.15.0 - /opt/homebrew/bin/node
Yarn: 3.5.0 - /opt/homebrew/bin/yarn
npm: 9.6.2 - /opt/homebrew/bin/npm
Browsers:
Chrome: 111.0.5563.64
Firefox: 111.0
Safari: 16.3
npmPackages:
@storybook/angular: ^7.0.0-0 => 7.0.0-rc.4
Additional context
No response
I'm on 7.0.8 and I'm facing this only when I set config.features.storyStoreV7
to false
.
./node_modules/@storybook/addon-essentials/dist/actions/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/actions/preview.mjs' (possible exports: argsEnhancers)
./node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs' (possible exports: decorators, globals, parameters)
./node_modules/@storybook/addon-essentials/dist/docs/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/docs/preview.mjs' (possible exports: parameters)
./node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs' (possible exports: highlightObject, highlightStyle)
./node_modules/@storybook/addon-essentials/dist/measure/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/measure/preview.mjs' (possible exports: decorators, globals)
./node_modules/@storybook/addon-essentials/dist/outline/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-essentials/dist/outline/preview.mjs' (possible exports: decorators, globals)
./node_modules/@storybook/addon-interactions/dist/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-interactions/dist/preview.mjs' (possible exports: argsEnhancers, parameters, runStep)
./node_modules/@storybook/addon-links/dist/preview.mjs-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/addon-links/dist/preview.mjs' (possible exports: decorators)
./node_modules/@storybook/angular/dist/client/config.js-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/angular/dist/client/config.js' (possible exports: __esModule, applyDecorators, parameters, render, renderToCanvas)
./node_modules/@storybook/angular/dist/client/docs/config.js-generated-config-entry.js 4:15-41export 'default' (imported as 'previewAnnotations') was not found in '/mnt/data/dev/repos/everflow/frontend-revam
./node_modules/@storybook/angular/dist/client/docs/config.js' (possible exports: __esModule, argTypesEnhancers, decorators, parameters)
undefined undefined
DefinePlugin
Conflicting values for 'process.env.NODE_ENV'
Letting the default true
value is worse. Components and stories are randomly breaking when switching from one to another until the page is refreshed.
I'm using 7.0.11 for web components and I also face the same issue when setting storyStorev7 to false which I'm having to do because of component rendering issues.
./.storybook/preview.js-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//.storybook/preview.js' (possible exports: __namedExportsOrder, parameters)
./node_modules/@storybook/addon-a11y/dist/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-a11y/dist/preview.mjs' (module has no exports)
./node_modules/@storybook/addon-essentials/dist/actions/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/actions/preview.mjs' (possible exports: argsEnhancers)
./node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/backgrounds/preview.mjs' (possible exports: decorators, globals, parameters)
./node_modules/@storybook/addon-essentials/dist/docs/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/docs/preview.mjs' (possible exports: parameters)
./node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/highlight/preview.mjs' (possible exports: highlightObject, highlightStyle)
./node_modules/@storybook/addon-essentials/dist/measure/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/measure/preview.mjs' (possible exports: decorators, globals)
./node_modules/@storybook/addon-essentials/dist/outline/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-essentials/dist/outline/preview.mjs' (possible exports: decorators, globals)
./node_modules/@storybook/addon-interactions/dist/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-interactions/dist/preview.mjs' (possible exports: argsEnhancers, parameters, runStep)
./node_modules/@storybook/addon-links/dist/preview.mjs-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/addon-links/dist/preview.mjs' (possible exports: decorators)
./node_modules/@storybook/web-components/preview.js-generated-config-entry.js 15:15-41
export 'default' (imported as 'previewAnnotations') was not found in 'C:/Users//source/repos//node_modules/@storybook/web-components/preview.js' (possible exports: argTypesEnhancers, decorators, parameters, render, renderToCanvas)
I am not positive, but this may be related to another issue I have been looking into. #22542
Does anyone have a repro of this issue, to see if it is the same as the one I am debugging and may provide more information on where to look?
My issue only throws at runtime and it is with a non-storybook dependency, but it is also an .mjs
error. I found that with the "exports"
property in package.json
of the imported package, the .mjs
file gets imported and throws an error about the default not being found, but if I remove the "exports"
property then the .js
file gets imported directly and it works fine.
Looking at some of the @storybook/*
packages, they are published with the "exports"
property in their package.json
. I think those packages are correct to be defining the "exports"
property, but I don't know why those imports work when building Angular directly and not through Storybook. I am slowly debugging it, by tweaking settings and stepping through parts of the code, but I am hoping someone more familiar with configuring builds knows where to look.
Not a minimal repro but easy to reproduce...
git clone https://github.com/nstuyvesant/carbon-charts.git
cd carbon-charts
git checkout pr-1544
git pull
yarn install
yarn build
cd packages/angular
yarn build:demo
Actually the broader yarn build
will reproduce it but it has a number of packages to build so too many messages. The last step homes in on it.
By the way, our Angular package is 16.0.1.