Skip to content
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

@capsizecss/unpack fontkit module import error #169

Closed
josephniet opened this issue Feb 14, 2024 · 4 comments
Closed

@capsizecss/unpack fontkit module import error #169

josephniet opened this issue Feb 14, 2024 · 4 comments
Labels
question Further information is requested

Comments

@josephniet
Copy link

I'm getting an error when trying to import unpack. Tested using a fresh vite deployment

main.ts
`import './style.css'
import { fromFile } from '@capsizecss/unpack';
import font from './font.woff2';

const metrics = await fromFile(font);
console.log('font metrics', metrics)`

package.json
{ "name": "capsize", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview" }, "devDependencies": { "typescript": "^5.2.2", "vite": "^5.1.0" }, "dependencies": { "@capsizecss/unpack": "^1.0.0" } }

Error
` VITE v5.1.1 ready in 194 ms

➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ press h + enter to show help
X [ERROR] No matching export in "node_modules/fontkit/dist/browser-module.mjs" for import "default"

node_modules/@capsizecss/unpack/dist/capsizecss-unpack.browser.esm.js:3:7:
  3 │ import fontkit from 'fontkit';`

PS - Awesome project! I ended up using the GH site to upload fonts & then lift the metrics from there & they worked absolutely perfectly.

@michaeltaranto
Copy link
Contributor

Hey mate, we have just merged a bit of an overhaul to how we build and manage package entry points (#168)

We have one more thing to merge before cutting the release, but keen to have your feedback on the following snapshot if you have time:

@capsizecss/unpack@0.0.0-master-20240214212615

@josephniet
Copy link
Author

image
pretty busy atm but I updated the package & re-run quickly & this is what I get.
When I run via await fromUrl instead I get a different error:
Uncaught ReferenceError: Buffer is not defined onLoadEnd index.js:17 blobToBuffer2 index.js:20 fromBlob index.mjs:75 fromBlob index.mjs:74 fromUrl index.mjs:93 async* main.ts:7
There's always a chance it's just something screwed up on my end...I do spend most of my life bashing away with things I don't understand :)

@michaeltaranto
Copy link
Contributor

If you have a repro you can share that'll help. In the mean time we have cut the release now, so any further testing can be against latest published versions.

@michaeltaranto michaeltaranto added the question Further information is requested label Feb 19, 2024
@michaeltaranto
Copy link
Contributor

Closing due to inactivity. Feel free to re-open if you find an issue in the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants