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
[build-storybook]: react publishable library TypeError: (0 , jsx_dev_runtime.jsxDEV) is not a function #8403
Comments
@rodrigofariow Does it work when
You may add |
Hye @puku0x Yep, that works! :D I also expect more people to have the same issue as me as it wasn't obvious what was the exact cause. Can't nx do something about it? Thank you very much the help and fast response! :) Cheers |
I also faced the exact issue. |
I have the same error, but I'm using the default
|
I fixed it by adding |
I've got many dependencies installed via |
I had the same issue and the setting the node env to development solved it ¯_(ツ)_/¯
Then |
That worked! Thanks @danielwanja |
Hi all! Thanks for filing an issue @rodrigofariow and thank you everyone who provided solutions! :) Do you think that this is an issue related to Nx? I see that a few workarounds are suggested here, which all work. Let me know if you think that this is a bug in the Nx codebase, or if I could close this issue! |
Hi @mandarini ! I'm not entirely sure if it is Nx related or storybook's but it definitely doesn't provide an out of the box experience for Nx users. It's a pretty easy workaround so I think it depends on what the Nx team wants to allow. I'm fine with closing the issue and letting it be useful for people that may have the issue in the future. What do you think @mandarini ? Thank you for your time. Cheers! |
Hi @rodrigofariow ! Thank you for the extensive feedback! :) It is in the plans to change the builder function we invoke from Storybook, to make sure users have the same experience in pure Storybook set-ups and in Nx+Storybook setups. I will close this issue, since as you said it's an easy workaround, but I will make sure I post here once we change our actual integration! Thank you all for jumping in with solutions! :D |
I think that the build should set the build mode to production. I’m trying to deploy this to netlify and if I manually set the node env to production, none of the dev dependencies get installed so it can’t run nx unless I add it as a non dev dependency. |
The
The issue is that if you run build in development you get the jsx_dev_runtime.jsxDEV error. If you run in production , the dev dependencies don’t get installed. It works if I just want to run it locally but that’s not point here. I need to deploy it. |
This is really bad.... nx storybook and storybook should work the same... if I want to run If I want to run it locally then I just run How do I incorporate "NODE_ENV=production yarn nx run shared-lib:build-storybook" into my project.json file? .... cant get this to work... does anyone have a 'fools guide' ? Just upgrade to 13.8.3 hoping that would fix things... doesn't |
Hi all. Thank you for your feedback, I am reopening the issue. We will try to start using the Storybook dev&prod builders, eventually. Sorry that it's taking long, and I am sorry if it's blocking you. I hope the workarounds will unblock you temporarily until a more solid solution is in place. |
I'm confused... I rebuilt my workspace so as I could start from a clean slate but I can't for the life of me get rid of this error I'm using VS Code and I tried running the nx console extension for storybook build which is effectively As advised above I tried running the command directly in the powershell window If I just run the storybook ie In normal Storybook I would do a build, get my static website and deploy it to an azure web app - all worked smoothly.... Not sure what I am doing wrong? Any ideas? Am I missing a dependency or something? |
for those who, like me, just use VS Code powershell terminal you will need to actually open a bash terminal as the powershell either doesn't work or I don't know what am doing (which is quite possible.. I'm a digital painter and decorator after all and couldn't give a monkeys about setting the node whatever in terminal whatever... that's what CLI's are for!) click the dropdown on the + sign in the VS Code terminal and select bash and then you can run the workaround to get it to work |
you are a life saver. this issue was haunting me for 3 days. |
Thank you @72gm for helping out! |
ISSUES CLOSED: nrwl#8403
I'm pushing a fix, should solve this issue. Eventually, we will switch the builder, and then maybe the fix will become obsolete. But should be good for now! :) Should've done this long ago, sorry about it. |
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
Building for a react publishable lib using
build-storybook
, although it completes successfully, throws a runtime error when openingindex.html
from the generated output of the build.This looks related to the new jsx transform:
Note that if I change the
.babelrc
to use the classic transform and if I addimport React from 'react'
to my lib it works fine.Expected Behavior
It should work out of the box with the new jsx transform (nx is configured to do so by default).
Steps to Reproduce
Either go to https://github.com/rodrigofariow/myorg for the generated output from the instructions bellow or run them directly:
npx create-nx-workspace@latest --preset=react --packageManager=yarn --style=styled-components --name=myorg --appName=myapp
yarn nx g @nrwl/react:library --importPath=@shared-lib --name=shared-lib --publishable
yarn add -D @nrwl/storybook
yarn nx g @nrwl/react:storybook-configuration shared-lib
yarn nx run shared-lib:build-storybook
7.
Environment
Thanks in advance for your time!
The text was updated successfully, but these errors were encountered: