-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
Jest test fails if files are imported from /dist
folder
#62
Comments
Importing from dist is allowed, but only when it is truly an |
@rektdeckard I’m using the package in a Next.js app router project and I need to import them separately due to the tree-shake issue in development. |
Just pushed an experimental update that has CJS artifacts and should be natively discoverable by node enviroments. Please give it a try by installing version 2.1.3, or with |
Note, you'll have to import them from |
Hey @rektdeckard 👋🏼 Joining the thread since I have the exact same use-case for these kind of imports, and the exact same problem as OP (only difference is that I'm not using Next's app router), but sadly changing my imports to be from I think probably fixing the type problems mentioned by this other recent thread might help! It seems no matter how I write the direct imports, it always fails either for the app itself, for the jest tests, or for the Storybook build. Let me know if I can help in any way, and thanks for looking into this! |
@mredigonda it probably fixed the problem but showed another error, that no type declarations were found. That is what I encountered in testing, at least. Types are now linked correctly thanks to #71 so you should find this to work in Note: just use |
@rektdeckard awesome, thank you! Now it seems the code typechecks correctly, storybook and jest all working for me locally, but now I have some error messages when deploying to Vercel:
And
Are you aware of what the problem could be? Otherwise let me know and I can continue troubleshooting. Thanks a lot! |
@mredigonda this looks like it could be linked to the Next compiler, as I have seen similar errors that trace back to using large component libraries (1000+ files) in their docs. I will try to find them. Are you deploying on Vercel? Have you tried using |
@rektdeckard thanks for your insight! Yes I'm deploying to Vercel, sadly I don't have any single big package that can be reduced massively by using The effort to update the way I import from I'm not sure how to move forward so I've postponed this one, but let me know if you have any ideas on what else I could try, and thanks again for your replies! |
I have this simple test file:
And this component:
Apparently the test fails if I try to import the file from
/dist/icons
folder.It works if I change the import line to:
Checking the package.json file of this module, it seems that
./dist/*
import is allowed.The text was updated successfully, but these errors were encountered: