DevMentor
DevMentor
DDeno
Created by DevMentor on 3/2/2025 in #help
deno dnt not including a TS file when building a NPM package
Hello I have 2 release problems I need help with. I have a project with a file located under "lib/utils/" folder that is called "logger-worker.ts". This file is loaded from a call in another source file when creating a worker thread, like:
this.worker = new Worker(path.join(process.cwd(), 'lib/utils', 'logger-worker.ts'), {
this.worker = new Worker(path.join(process.cwd(), 'lib/utils', 'logger-worker.ts'), {
However dnt is not builing "logger-worker.ts", because I assume it doesn't get imported, so is being ignored. I don't see it in the NPM output folder. So how can I get dnt to build this typescript file when building a NPM package? This all works fine when I am developing and running my project from deno. The other prepliexity I have (2nd problem), when "logger-worker.ts" gets built by dnt, since my code is loading, "logger-workers.ts" and dnt will transpile it to "logger-worker.js", the code will break when run from the NPM import library, since it looking for a ".ts" file for the worker thread. So what can I do, so my typescript project will work from deno under development and from another project using the NPM package library with Node.js?
2 replies