16
lopu
12d

HOW THE FUCK

DO I USE A NPM PACKAGE

THAT DOESN'T SUPPORT IMPORT X FROM PACKAGE

IN A TYPE:MODULE

REPO?

WHY THE FUCK CAN'T NODE JUST SUPPORT BOTH

WHAT IN THE FUCK

HOW DOES WEBPACK LET YOU USE BOTH?!

I CANNOT FIND A WORK AROUND FOR ERROR

SyntaxError: The requested module 'file-type' does not provide an export named 'default'

WHAT THE FUCK?

DO I NEED TO USE A DIFFERENT PACKAGE?

WHAT THE FUCK

Comments
  • 4
    Holy shit the splitting up of compatibility between CommonJS and EJS modules is the most absolutely brain dead dumb fart moronic indecipherably stupid inept decision I've ever come across
  • 5
    Well I read this and I kiiiiiind of understand better now

    https://redfin.engineering/node-mod...

    Seems like EJS is actually completely backwards compatible with CJS?

    You just need to do

    import cjsModule from './foo.cjs';

    const {foo} = cjsModule;

    for named CJS exports?

    Turns out in my project the EJS module just didn't have a default export, was doing an export * from
  • 2
    I ran into this and a similar roadblock and just abandoned the pet project. 🤦🏻‍♀️
  • 2
    @Root oh no :( it's so frustrating, I think that ejs is completely backwards compatible with cjs though so if you use ejs throughout your project you should be fine :O don't let your pet die
  • 0
    God damnit my favourite process manager PM2 doesn't support ESM

    Btw I've been calling it EJS, I think it's ESM
  • 2
    @lopu It’s been so long now and I no longer have a use for it. :<

    I’ll probably rebuild it in another language when/if I need it. (Tagged and nested async logging library)
  • 2
    @Root ooo, love a good logger
  • 3
    This kind of post is exactly why I came to this website
  • 0
    @HoloTheDrunk Good quality rant, yeah. They’re rarer of late, but they still exist.
  • 0
    Yes the terms are ESM and CJS

    While the split seems insane at a glance there are blog posts from the npm foundation about how they came to the tough decision to do it, for example there are security issues with CJS
  • 0
    For your own sake, stay away from JavaScript.
Add Comment