Using docx@v7.4.0 in Deno will prevent the process from finishing
See original GitHub issueI’ve been using docx
in Deno by importing it from the esm.sh CDN. This is a service that performs some code transformation to serve NPM packages in an ES format. Conveniently it can be used to use just about any NodeJS module in Deno.
So far, docx@7.3.0
has been working like a dream.
Unfortunately, bumping the dependency version to docx@7.4.0
will prevent the process from finishing naturally.
To reproduce:
- Install Deno or run it in a Docker container
- Create a file
test.ts
and paste the following contents into it;import docx from 'https://esm.sh/docx@7.3.0'; new docx.Document({ sections: [], }); console.log('End of program');
- Run it as
deno run test.ts
nb; using Docker, an easy way to reproduce is to docker run -it --init denoland/deno:ubuntu sh
, then echo "import docx from 'https://esm.sh/docx@7.4.0'; new docx.Document({ sections: [] }); console.log('End of program');" > test.ts
and deno run test.ts
.
Expected
- The process exits after logging “End of program” to terminal" – which is what happens for the same script in NodeJS, or for the same script but depending on
7.3.0
Observed
- “End of program” is logged to terminal, and
- The process never finishes
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Deno.exit terminates entire process when using run --watch
I expected Deno.exit to terminate the script, but keep the file watcher ... file:///Users/sidd/code/issue/main.ts Finished Watcher Process ...
Read more >Introduction | Manual - Deno
Introduction. Deno is a JavaScript, TypeScript, and WebAssembly runtime with secure defaults and a great developer experience. It's built on V8, Rust, ...
Read more >5 Changes Coming Soon to Deno - Fusebit
Read this blog post and learn the highlight 5 key improvements to Deno in releases in 2022.
Read more >An Introduction to Deno: Is It Better than Node.js?
json file to keep track of a project's dependencies. Deno does away with those mechanisms in favor of a more browser-centric way of...
Read more >Bun? Deno? Node.js? Creating your own JavaScript Runtime ...
Bun? Deno ? Node.js? Creating your own JavaScript Runtime using V8, Libuv and more.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey @dolanmiu, thanks for spending time on this so promptly. I hope that, beyond the mystery of this bug, it was a pleasant first contact with Deno 😃
Yes, all works well in NodeJS. I’m puzzled wrt what could cause this, intuitively I’m thinking about possibly a stream that is not closed or anything. I couldn’t readily find anything in
git diff 7.3.0..7.4.0
that would explain it, but I must admit that I have only scrolled through so far. Since neither of us can readily tell what causes the issue I may spend some of the boss’s time to dive into it again later.I have no idea what the bug is, and I’ve not ran into issues before that were caused by esm.sh transformation. Unfortunately I do know that rewriting to ES modules will not magically make it work better in Deno: one of the things that Deno requires is that all imports have the proper file extension – something that NodeJS typescript would actively complain about. Since
docx
doesn’t do that, some transformation will remain necessary.nb. For some of my own projects, I (re)write for Deno and use Deno dnt to publish that package for Node as well.
Thanks for your response!
Excellent find!
Thank you so much