Closed wscourge closed 1 week ago
As this package seems to be abandoned, I've recreated and fixed this error in my package.
You can install it if you want:
npm install text-to-image-2
Hi @wscourge, thanks for the issue report. As @Pnlvfx says, this project hasn't seen any activity for a while mostly due to my lack of spare time with a growing family and a full day job.
However, I'm very happy to accept PRs for fixes, or even better, new collaborators on the project to keep it alive and up to date. Maybe @Pnlvfx would be interested 😉
@wscourge I just released version 6.0.0 which has been tagged as @next since 2022 🙈 Everything should work more smootly in that release. Can you try and let me know?
Thanks to this little kick-in-the-butt I'm also in the progress of updating dependencies and bringing the project up to date.
I don't think the 6.0.0 modules are setup correctly. The modules are defined at the path /dist
but cannot be loaded from that directory as it is not specified in the package.json
import { generate } from 'text-to-image/dist';
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './dist' is not defined by "exports"
If I remove the /dist path the module is not found.
@jderose9 it should be enough to import { generate } from 'text-to-image'
Check the example at https://codesandbox.io/p/sandbox/text-to-image-v6-example-s5jegv
I even took @wscourge's example code sandbox and updated the dependency to 6.0.0 and it's working fine!
Let me know if that helps.
@wscourge @jderose9 I had a closer look at this issue and you are right that there were some issues with the exports even in version 6.
Module resolution seems to be a very gnarly subject, and it's not really trivial to publish a package with submodules that is usable by different kinds of module resolvers while also getting TypeScript support. After some research I ended up employing the "extensionless" strategy outlined here, which ditches the dist
folder in the released npm package altogether.
I'd be thrilled if you're willing to try out the newly published 7.0.0 version (tagged as text-to-image@next
) and let me know if that resolves your issues. There's also a new CodeSandbox that uses this version. For TypeScript support, note that you'll need "moduleResolution": "Node16"
in your tsconfig.json
.
Version 7 also drops support for node < 18 and upgrades all dependencies.
@bostrom Thank you! 7.0.0 is working just fine for me now on node v20.17.0.
And yes, I have also found module resolution is a huge pain.. that's why I couldn't give much more feedback than it didn't work :)
@jderose9 thanks for the feedback, I'll go ahead and make 7.0.0 stable. Closing this for now.
Version of the library @next
Describe the bug
export default
is undefinedTo Reproduce Use this sandbox.
Expected behavior
import textToImage from "text-to-image"
producing an object with.generate
,.generateSync
and all other public methods.Screenshots N/A
Additional context N/A