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
@nrwl/angular:storybook-configuration schematic creates preview and main files as javascript #10394
Comments
Thanks for the detailed bug report @asgerjensen . I will look into this at some point. I want to see if creating If you're familiar with the Nx codebase, would you care to give this a shot? |
I’m not particularily familiar with the codebase, but if you can give some pointers as to where I should look, I can give it a stab
…Sent from my iPhone
On 20 May 2022, at 14.42, Katerina Skroumpelou ***@***.***> wrote:
Thanks for the detailed bug report @asgerjensen . I will look into this at some point. I want to see if creating .ts config files could create any potential issues. In any case, we could add an option in the generator and let the user choose.
If you're familiar with the Nx codebase, would you care to give this a shot?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
ISSUES CLOSED: nrwl#10394
ISSUES CLOSED: nrwl#10394
ISSUES CLOSED: nrwl#10394
@asgerjensen I took this up, no worries. I just added an extra flag to the generator, |
ISSUES CLOSED: nrwl#10394
ISSUES CLOSED: nrwl#10394
ISSUES CLOSED: nrwl#10394
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
Running
npx nx g storybook-configuration <project>
creates the preview and main files as javascript files, instead of typescript.This means, if you import from another local library some injection tokens, for instance, compilation of the storybook fails, if that same library isn't referenced from any story in the library.
This is an issue, if you have some global configuration you want to provide to all stories, using classes or tokens from other services.
Expected Behavior
I expected it to create typescript files, so any references to other local libs would be correctly identified by webpack.
Is this a regression? .i.e Did this used to be the behavior at one point?
No. But it is a timesink trap due to the mysterious error message gotten during compilation.
Steps to Reproduce
In
libs/test/tokens/src/index.ts
addin
apps/app1/.storybook/preview.js
addTry to run storybook
See that you get the failure below
If, you then add to
apps/app1/src/app/app.component.stories.ts
so it reads:and run storybook again
it now works, because the typescript compilation somehow pulled the NEW_TOKEN into the build-context (or something, i dont really get what is going on)
Workaround
Change preview.js to preview.ts, and main.js to main.ts, and change the
.storybook/tsconfig.json
, to beand the initial, failing, example now works.
Minimal github repo:
https://github.com/asgerjensen/nx-storybook-preview-js-issue
Failure Logs
Environment
The text was updated successfully, but these errors were encountered: