Gemma Blackgemmablack.dev·Nov 17, 2024Node.js: using fs.watch to re-import CommonJS modules.Disclaimer. This is an investigation into what is possible. Not a fully-blown solution into how to reload modules without restarting the whole server. In a previous article, I was investigating how to use require.cache to refresh a module by deletin...Discussfs.watch
Gemma Blackgemmablack.dev·Nov 17, 2024Node.js: refreshing a module using require.cacheThis is purely in reference to CommonJS modules. TLDR Before I bore you with why I did this, refreshing a module can be done by deleting its reference in the require.cache object. Like so: require('./some-module') // use module delete require.cach...Discussrequire.cache
Dana Ciocandanaciocan.com·Nov 5, 2024Why are there so many types of JavaScript modules?Let’s cast our minds back to 1995. Netscape Navigator was the predominant browser folks were using to get their internet fix (if at all - there was certainly no guarantee you had the internet at home back then!) and connecting to the internet sounded...Discuss·2 likes·35 readsJavaScript
Nirmal Sankalananirmalsankalana.hashnode.dev·Aug 11, 2024Understanding CJS and ESM Imports and ExportsAs JavaScript has evolved, its module system has also improved. Two primary module formats dominate the ecosystem: CommonJS (CJS) and ECMAScript Modules (ESM). Understanding these two formats is crucial for developers, especially when working with mo...Discuss·10 likesJavaScript
Adegbite Moyomademadevblog.hashnode.dev·Aug 6, 2024CommonJS vs ES6 Modules: A Developer's JourneyAs I've delved deeper into JavaScript development, I've come to realize that understanding module systems is crucial. Trust me, wrapping your head around CommonJS and ES6 modules isn't just academic—it's key to truly grasping how modern JavaScript wo...Discuss·2 likesJavaScript
JoLoblog.jolo.dev·Jul 12, 2024Oh CommonJS! Why are you mESMing with me?!It was a normal patching day. I patched and upgraded my npm dependencies without making code changes, and suddenly, some of my unit tests failed. Wtf! My tests failed because Jest encountered an unexpected token; they failed because Jest cannot han...Discuss·28 readsesm
Syed Muhammad Yaseensmy.hashnode.dev·Jun 25, 2024TypeScript SDK Development: A 5-year-old could follow this step-by-step ~ Part 1, our first MVPHelloooooooo! Hope you're doing great! This is SMY! 👋 Let's Jump right in 🚀 Part 2: https://smy.hashnode.dev/typescript-sdk-development-a-5-year-old-could-follow-this-step-by-step-part-2-folder-structure-integrating-api Part 3: https://smy.hashnode...Discuss·52 readsTypeScript SDK Developmentsdk
Gautam VajaforCodeParrot 10x Dev10xdev.codeparrot.ai·Feb 10, 2024require Vs import: Old Vs New war in Javascriptimporting a module is a fundamental concept that refers to the process of bringing one module's code into another module. Think of it as borrowing a book from a library; you don't need to own every book, you just borrow what you need when you need it...Discuss·10 likes·127 readsES6
CHIRAG KUMARichiragkumar.tech·Jan 28, 2024ES6 vs Common Javascript in node jslearn about Es6 modules and common js, after this no doubt ES6 modules are asynchronous loaded while, Common js modules are synchronous loaded How to work with common js const fs = require("fs") const fd = rs.readFileSync("filename.txt", "utf-8"...DiscussNode.js
Ijlal Ahmadijlalahmad.hashnode.dev·Jan 15, 2024Crafting Hybrid NPM Packages with TypeScript: A Comprehensive GuideIn this article, I'll walk you through the process of achieving a hybrid nature for npm packages, drawing from my own experiences and addressing potential challenges that may arise. I'll assume that you have a basic understanding of deploying npm pac...Discuss·98 readsnpm