-
Notifications
You must be signed in to change notification settings - Fork 6
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
Bug when importing defineFontProvider
: Package subpath './utils' is not defined by "exports"
#170
Comments
Hey @ziadomalik! 👋 I'm here to help you with any bugs, questions, or contributions you have. Let's tackle this issue together while we wait for a human maintainer. The error you're encountering suggests that the To resolve this issue, ensure that you are importing import { defineFontProvider } from '@nuxt/fonts/utils' This import path aligns with the "exports": {
".": {
"types": "./dist/types.d.ts",
"import": "./dist/module.mjs",
"require": "./dist/module.cjs"
},
"./utils": {
"types": "./dist/utils.d.mts",
"import": "./dist/utils.mjs"
}
} If this does not resolve the issue, ensure that your project dependencies are up-to-date and that there are no conflicting versions of the rm -rf node_modules pnpm-lock.yaml
pnpm install Additionally, make sure you are using the recommended version of the If the issue persists, it might be related to recent changes in the repository. There have been updates in version Lastly, ensure you are using the recommended package manager version, |
Confirmed everything the bot said, I did everything right. |
Custom providers should be defined in this way: https://github.com/nuxt/fonts/blob/main/playground/providers/custom.ts Edit: Ignore this. Sorry I didn't read it clearly. |
Possibly the issue is that we don't provide a solution for CJS/require, which might be how jiti is resolving the import. We can amend the build config. |
Interesting, the docs tell a completely different story, thanks for clarifying. Will try this out.
I will look into that, good opportunity to contribute. |
Update: I tried just updating the "./utils": {
"types": "./dist/utils.d.mts",
"import": "./dist/utils.mjs",
+ "require": "./dist/utils.cjs"
} This just results in the file being skipped: The |
Output of
npx nuxi info
:My custom provider in
~/providers/ComputerModernFontProvider.ts
:Picture of the Error:
Steps & Contribution
I find this super weird since
./utils
is already defined in thepackage.json
here.If someone could give me some pointers towards the solution, I'd happily create a PR.
Thank you in advance.
The text was updated successfully, but these errors were encountered: