#Building a TypeScript Project

1 messages · Page 1 of 1 (latest)

errant laurel
#

Hello! I'm starting to use Bun and have gotten most of the setup finished. However, when running bun build src/index.ts --outdir dist/index.js --target bun and then running bun run dist/index.js, I get an error saying TypeError: undefined is not an object (near '...(function () { })...'). I don't get this error when compiling using tsc, so I'm a bit confused as to why I'm getting errors compiling to Bun. The error points to a class where I extend to another class like this:

export default class NineAnime extends AnimeProvider {
  // Attributes
}

In the built index.js file, the line where the error is thrown is like this:

class NineAnime extends AnimeProvider {
  // Attributes
}

All my code is open sourced here, with the main class where the error is thrown here.

Personal Analysis
I think the error might be due to circular dependencies since Bun compiles into one singular file whereas tsc compiles to a ./dist folder with multiple files. I'm wondering if there is a fix the Bun community has found or if it's possible to do bun build and output multiple files rather than just one.

#

I also have recently tried this for locating circular dependencies, but I get No circular dependencies found.

Medium

Lately, I was researching how to compile Angular@6 project using angular-compiler - ngc. And found out that one of a reason an Angular…

errant laurel
#

Decided to completely recode my backend with bun instead. If anyone sees this it might be helpful to just recode everything to see what the problem is. It sucks but it’s worth imo. My backend is a lot faster with bun

#

Even without clustering

tame mountain
#

Is that better or uses bit / much more?

errant laurel
#

Memory usage is better I think

tame mountain
#

Hmm, what kind of method do you use to get to it?

#

For d.js, in nodejs, the ram usage is less, slow. However in bun, it uses more but faster, I presume

#

Im having a lot of trouble locating how to make my code efficient for mem

#

I do use gc and sweepers however it doesn't bring down the usage to how I prefer it

errant laurel
errant laurel
#

If you want to take a look at my code I'm updating my bun branch here.

tame mountain
errant laurel
#

i use sqlite for data storage so maybe u could use that

tame mountain