Prevent a package from being treeshaken/ deleted from final build on production
soo am trying to use pino with axiom, but vite keeps deleting "@axiomhq/pino" package.
i even tried to import it, but it is still being deleted
how can i pervent that.... ?
11 Replies
GitHub
After building 'unable to determine transport target for "@axiomhq/...
Hello ! thanks for the great package! I have been trying to connect to axiom and send logs. while in development everything works fine. but in deployment I keep receiving the follwoing error unable...
it seems like Vite is deleting the "cjs" folder while the package is using it
which is causing this issue. how to pervent vite from deleting cjs folders ?
Not entirely sure, but i do know with some packages you need to wrap it up in the nuxt build as a list of transpiled packages in your nuxt config.
In say the case you want to use https://github.com/zxing/zxing with, you'd want to do in the nuxt.config.ts.
So you may need to do
GitHub
GitHub - zxing/zxing: ZXing ("Zebra Crossing") barcode scanning lib...
ZXing ("Zebra Crossing") barcode scanning library for Java, Android - zxing/zxing
IT IS WORKING ! 😮
on local build, works fine.
on vercel it doesn't
works like a charm in local build
seems like vercel is doing some random things in the background when building the project
soo... sadly am probably just gonna change pino to winston T_T
is the error the same in vercel?
yup
hmm, because i was able to uplad a project that uses zxing to vercel with the build transpile thing
i tried to also redeploy it without using the cache but still same issue
it is so weird that it builds fine on my machine but not on vercel
yeah, so this was my project that was then used on vercel
so yeah, it is just the build thingi
i also tried this
but same issue
anyway i am just leaving pino for now.
my biggest issue is that i have to change all instance of my loggings
looking like this
logger.info({data1,data2},"error message')
to this
logger.info("error message', {data1,data2})
🥲
Thank you for your helpwhat a shame, no problem 🙂