Question with regards to import on a esm project #295
Unanswered
lucassmcardoso
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I don't know if this warrants an issue, therefore I'm posting it here as a question. Neither Have I been able to find an issue or discussion pertaining this problem.
Currently I've run into a problem where it outputs an error as illustrated below.
This happens when I try running my project as an es module. In other words, when I type
{ "type": "module" }
inpackage.json
.If I do as it's suggested in the error message I receive yet another error:
From both errors I assume the problem is the
@pdfme
module not being exported as an es module. Based on that I tried including{ "type": "module" }
to the generator package, but it started another sequence of errors. Some of this new errors are with regards to the esm built files not importing using the.js
extension, which I tried fixing, but then the errors moved to the@pdfme/common
dependency. At this moment I gave up and came here in other to ask for help. I want to know wether this is a known issue, have a workaround or I've possibly configured something wrong.My configuration
I'm running a minimal
node.js
project with this package andtypescript
in order to replicate the problem which had first appeaed in another project i'm working in. The tsconfig file is the node 18 base from tsconfig-bases and thepackage.json
is only importing thets-node
andtypescript
dependencies other than this one.I'm running this on a Windows 11.
I was using
node 20.9.0
but I've downgraded to the18.18.1
, since the v20 was introducing an unkown extension.ts
which I was not able to fix.Obs
I know there's another discussion with regards to this problem, but I want to know if there's a solution that does not include choosing to resolve to
CommonJS
. Is there a way to keep my project as aesm
one?Beta Was this translation helpful? Give feedback.
All reactions