9

I'm so fucking fed up with the npm ecosystem. Every single god damn time I've had to do anything it always takes DAYS to figure out how to get anything working and I always have to try multiple tools or libraries to final get it half way sorta.
I'm so fucking annoyed right now. They always turn out not that great, have lacking features or trivial oversights in functionality and ALWAYS have garbage documentation.

I just want to build a fucking npm library with TypeScript to be used with node. That's probably the NUMBER 1 use case so how fucking hard can that be?

So obviously I start out with tsc. That's quite simple, compiles all my stuff and shits out .js and .d.ts files. Okay so how do I use them via es6 import? I don't fucking know, because it doesn't work no matter what I do. The 'module' option in tsconfig is absolutely useless btw. It does *literally* fuck all. Nada. Absolutely nothing.
Okay I'm far from defeated, maybe I'll just have to bundle it. So I waste two days finding something that half works (I'm using fusebox right now) and at last I get a stupid es6 module as a single bundle... But what about type the declarations? They are nowhere to be seen and of course there's no option for that. Because Fusebox the pile of shit that's oh so well Typescript integrated apparently doesn't think TYPE DECLARATION FILES are needed. What the actual fuck.

And that's where I'm now. I need the fucking .d.ts files so I can use it as a module with import. Do I really need another fucking piece of shit tool that bundles these files? Honestly fuck all of this. "Oh the Javascript ecosystem is so great" YEAH fucking great, alright. Where 90% of the ESTABLISHED tools and libraries (we don't talk about the landfill of all the other shit) flat out don't do what you need. Again, how fucking hard can it be to make a npm lib with typescript? That should be NATIVELY SUPPORTED. If not by npm atleast by typescripts tsc.

FUCK NPM. FUCK JAVASCRIPT. AND FUCK THE WHOLE ECOSYSTEM

Comments
  • 1
    This is fascinating. I have never tried to just run one part of a project in Typescript to use the "compiled" portion of it with JS. I normally just say fuck it and write the entire damned thing with TypeScript and use the compiled files **only** as the "run" target. Never separately so I cannot imagine what is causing all the fuss. I found a stack overflow post in which people were discussing this weird thing regarding module resolution from one lang(TS) to the other(JS), someone even mentioned that this was a bug, the thing is, it is from 2017 so I don't really know no mo. https://stackoverflow.com/questions...

    Let us know if you manage to fix it man! or if you want you could post the code somewhere and we can give it a shot, maybe you are overlooking something that could benefit be seen by two devs :D either way, it is a fucky situation
  • 0
    @AleCx04 Hey, thanks. The thing is I want to use my typescript library in another typescript project. I can't even get that to work. Ultimately my goal is to have the library usable from both JavaScript and TypeScript and from node and client side (with the proper node stream polyfill)
  • 0
    I do have some similar setup for my ts library (dist is with es modules and without) take a look maybe it gets you on the right track. Ahh and idk but tsc was enough for me (no fusebox or webpack).
    https://github.com/asdftd/...
  • 2
    This is why I gave up on my nested, async javascript logger. The code isn't hard to write, and the api was fun to design. But getting it to fucking import was a fucking never-ending nightmare.

    I still get angry thinking about it.
Add Comment