Ask coding questions

← Back to all posts
How to write a NodeJS Package for ES5 & ES6?
h
RayhanADev (2526)

Right now I face a dilemma. My package, ReplAPI.it, is being used in scenarios which need an ES5 package and scenarios which need an ES6 package. I wrote my code adhering to ES6 standards. Is there any way to make it work in NodeJS CommonJS and NodeJS ModuleJS.

Also bonus is there a way to make NodeJS packages except for the web (<script src="...">)?

Answered by realTronsi (926) [earned 5 cycles]
View Answer
Comments
hotnewtop
realTronsi (926)

1) Most ES5 features are compatible with ES6
2) Not a package creator myself, but if you look up for hybrid npm packages there should be some guides.
3) Use rawgit. https://rawgit.com/[name]/[repo]/master/src/OfwfsHpoobHjwfZpvVq.js

Also hi

RayhanADev (2526)

@realTronsi hiiii!
Dude how's life! It's been quite some time :D.

Also thanks xD, that's exactly what I was looking for, yet I didn't know it.

realTronsi (926)

@RayhanADev

hai, yeah it's been a while. Lost some motivation so I kinda paused for a while. What have you been up to?

rip you didn't find the secret message OfwfsHpoobHjwfZpvVq
RayhanADev (2526)

@realTronsi yep still here (Replit doesn't send notifications immediately after a ping lmao)

I've kinda been on and off myself. I made a few games and that got popular fast. I was completely ignored during the Kaboom Game Jam sometime last month even though I had the most popular game. I got really into Overwatch for some reason. I've undertook several huge projects (like revamping my portfolio). And I'm cramming for AP tests in a week :P.

wait i don't get it what
realTronsi (926)

@RayhanADev Oh nice, yeah I pinged because there were so many msgs from the april fools repl and I thought I got covered up.

Which AP classes are you taking?

on 3) I sent this template link and theres a secret message: https://rawgit.com/[name]/[repo]/master/src/OfwfsHpoobHjwfZpvVq.js
realTronsi (926)

@RayhanADev wait sorry I take back 3), apparently rawgit is shutting down!

realTronsi (926)

@RayhanADev you've probably responded by the time this gets to you but rawgit isn't accepting new repos. It still works for old repos but you could use any other cdn.

RayhanADev (2526)

@realTronsi hahahahah rip yeah I still get those pings too

I'm taking ap hug, psych, csp, and csa lmfao. A bit too many

RIP rawgit shut down that's sad.

realTronsi (926)

did you figure out sekret D:< @RayhanADev

RayhanADev (2526)

@realTronsi nein I am very confuzzled about it lol

realTronsi (926)

@RayhanADev OfwfsHpoobHjwfZpvVq hint: caesar's chicken salad

RayhanADev (2526)

@realTronsi LMFAO

NeverGonnaGiveYouUp

GG well played xD

realTronsi (926)

@RayhanADev surprised you were able to figure it out with chicken salad, u big brane