export types may be wrong from remark-pdf/node
sr-skillmore opened this issue · comments
Describe the bug
Export types don't seem to be working correctly from remark-pdf/node
when importing import pdf from "remark-pdf/node";
in a .ts
file in a Vue 3 + Nuxt 3 application.
My remark-pdf
version is 0.0.12
.
![Screenshot 2023-07-05 at 11 07 41 AM](https://private-user-images.githubusercontent.com/123024042/251211396-93815aca-e61c-486b-ac0b-f6676fcd04b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMjg0ODUsIm5iZiI6MTcxOTEyODE4NSwicGF0aCI6Ii8xMjMwMjQwNDIvMjUxMjExMzk2LTkzODE1YWNhLWU2MWMtNDg2Yi1hYzBiLWY2Njc2ZmNkMDRiOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyM1QwNzM2MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05N2NmNDkzYjZmMDA2Y2U3YTE4YWQ3NzZhNTcwNmZhZWE3MzA5YzgwNWM3Yjc3YmEwNWY4YTQ0YmM1YmNmYzZkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.9Hz1NhMiYW0qKoESrtNy3vQm6k0SoPsl3Y1ap47F7h4)
My node_modules
folder structure for the package remark-pdf
is as below: (this is from my actual project node_modules
folder and not from stackblitz recreation which does not show the node_modules
folder at all)
![Screenshot 2023-07-05 at 10 52 11 AM](https://private-user-images.githubusercontent.com/123024042/251207654-305a4fe4-7b04-4638-b75d-a4331fa114d0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMjg0ODUsIm5iZiI6MTcxOTEyODE4NSwicGF0aCI6Ii8xMjMwMjQwNDIvMjUxMjA3NjU0LTMwNWE0ZmU0LTdiMDQtNDYzOC1iNzVkLWE0MzMxZmExMTRkMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjIzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYyM1QwNzM2MjVaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1hYTNkMjE3Y2FiNTY4ZmVlYzYyODRmZDAyOWEyZDJkZTM1ZWM3MjQzNDYxYTA2NGZkZGRhNGNlNzJkOTY3NjMwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.laeJ16PUp3P4GaDxwdCuIAbG8c3SSNc6qnitIaRSnk4)
When I add the lib
to the import path, import pdf from "remark-pdf/lib/node";
the typescript error goes away. However, the terminal gives this warning:
WARN "remark-pdf/lib/node" is imported by "server/api/md-to-pdf.post.ts", but could not be resolved – treating it as an external dependency.
So, assuming that I cannot use the lib
in the import path, I am doing as below to ignore the typescript error.
// @ts-ignore: export types are wrong from remark-pdf/node
import pdf from "remark-pdf/node";
To Reproduce
Please see the stackblitz recreation here.
Expected behavior
The typescript error needs to be corrected when using the import import pdf from "remark-pdf/node";
Cannot find module 'remark-pdf/node' or its corresponding type declarations.
There may be some inconsistencies with the way exports are set up for this package and this needs to be updated.
Additional context
Add any other context about the problem here.
Noticed this in the network response:
{
"url": "/api/markdown-to-pdf",
"statusCode": 500,
"statusMessage": "",
"message": "Cannot find module '/app/.output/server/node_modules/remark-pdf/lib/node.js' imported from /app/.output/server/chunks/markdown-to-pdf.post.mjs",
"stack": ""
}
When looking into /app/.output/server/node_modules/remark-pdf/lib/node.js
there is no node.js
file.