Tag

CommonJS

1 views collected around this technical thread.

Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Apr 9, 2024 · Fundamentals

A Comprehensive Overview of JavaScript Module Systems: From Traditional Scripts to ESM

This article traces the evolution of JavaScript module systems—from the early script tags and manual dependency ordering, through CommonJS, AMD, and UMD, to the modern ECMAScript modules—explaining their origins, challenges, and how bundlers and package fields enable seamless usage across browsers and Node.js environments.

AMDBundlersCommonJS
0 likes · 13 min read
A Comprehensive Overview of JavaScript Module Systems: From Traditional Scripts to ESM
ByteFE
ByteFE
Aug 16, 2023 · Frontend Development

Evolution of Frontend Module Systems and Major Module Specifications

This article traces the history of frontend modularization from early global‑function scripts through IIFE, CommonJS, ES6 modules, AMD and CMD, explaining why modularization is needed, how each approach works, their drawbacks, and the key features of each specification.

AMDCMDCommonJS
0 likes · 14 min read
Evolution of Frontend Module Systems and Major Module Specifications
DaTaobao Tech
DaTaobao Tech
Aug 16, 2022 · Backend Development

Understanding esModuleInterop: CommonJS vs ES Module in TypeScript

The article explains how toggling TypeScript's esModuleInterop flag changes import behavior between CommonJS and ES Module syntax, causing runtime errors like “TPS is not a constructor,” and offers fixes—either revert the flag and use namespace imports or enable it and use default imports.

CommonJSESModuleModuleResolution
0 likes · 7 min read
Understanding esModuleInterop: CommonJS vs ES Module in TypeScript
DaTaobao Tech
DaTaobao Tech
Aug 1, 2022 · Backend Development

Configuring Dynamic Entry Points for Node Packages: main, type, exports, and module fields

Library authors can configure package.json using main, type, exports, and module fields to provide separate CommonJS and ES module entry points, enabling runtime selection based on import or require, improving tree‑shaking, bundler compatibility, and TypeScript type resolution while restricting undefined sub‑paths.

CommonJSESMExports
0 likes · 11 min read
Configuring Dynamic Entry Points for Node Packages: main, type, exports, and module fields
Sohu Tech Products
Sohu Tech Products
Aug 25, 2021 · Backend Development

Understanding Node.js Module System and Implementing a Custom Require Loader

This article explains how Node.js implements module loading using the CommonJS wrapper, demonstrates the role of the built‑in vm module for isolated execution, and walks through building a custom Require function with path resolution, file reading, extension handling, caching, and automatic extension resolution.

CommonJSModule SystemNode.js
0 likes · 14 min read
Understanding Node.js Module System and Implementing a Custom Require Loader
ByteDance Dali Intelligent Technology Team
ByteDance Dali Intelligent Technology Team
Jun 11, 2021 · Backend Development

Node.js Package Module Import/Export Rules and Conditional Exports – A Comprehensive Guide

This article explains the latest Node.js package module specifications, covering how the "type", "exports", and "imports" fields in package.json determine ESM or CommonJS loading, the history of version changes, subpath mappings, conditional exports, and best practices for dual-module packages.

CommonJSESMExports
0 likes · 27 min read
Node.js Package Module Import/Export Rules and Conditional Exports – A Comprehensive Guide
vivo Internet Technology
vivo Internet Technology
Mar 3, 2021 · Backend Development

Understanding the Node.js Module System: Resolving, Loading, Wrapping, Caching and Exports

Node.js implements the CommonJS module system by using global require and module objects that, when a module is requested, resolve its absolute path, load and wrap the file, evaluate it to populate module.exports, cache the result, and handle exports, circular dependencies, JSON and native addons.

CommonJSExportsModule System
0 likes · 21 min read
Understanding the Node.js Module System: Resolving, Loading, Wrapping, Caching and Exports
vivo Internet Technology
vivo Internet Technology
Jun 29, 2020 · Frontend Development

Understanding CommonJS and Front-End Module Systems

The article traces JavaScript’s module evolution from inline scripts to CommonJS’s file‑scoped exports and require system, explains its minimal bundler implementation, compares AMD and CMD alternatives, and finally introduces native ES6 import/export syntax, highlighting key differences and the gradual deprecation of CommonJS.

AMDCommonJSES6
0 likes · 21 min read
Understanding CommonJS and Front-End Module Systems
政采云技术
政采云技术
Dec 8, 2019 · Backend Development

Exploring the Source Code of the Node.js Module System

This article delves into Node.js’s module system, explaining the CommonJS specification, how Node implements module loading, resolution, caching, and execution, and provides detailed analysis of core source code including Module constructor, require, _load, _resolveFilename, and file extension handling.

CommonJSModule SystemNode.js
0 likes · 17 min read
Exploring the Source Code of the Node.js Module System
360 Tech Engineering
360 Tech Engineering
Mar 19, 2019 · Backend Development

Understanding Node.js ES Modules and CommonJS Interoperability

This article explains how Node.js supports ES modules since version 8.5, compares CommonJS and ES module loading behaviors, demonstrates interoperability techniques with code examples, and outlines the practical implications of using the experimental‑modules flag for backend development.

CommonJSES ModulesModule Interoperability
0 likes · 8 min read
Understanding Node.js ES Modules and CommonJS Interoperability
Qunar Tech Salon
Qunar Tech Salon
Jun 2, 2017 · Frontend Development

A Review of Frontend Moduleization Development and Tooling

This article reviews the evolution of frontend moduleization over the past decade, discusses the problems of early script inclusion, presents various solutions such as namespaces, closures, CommonJS, ES6 modules, and modern build tools, and illustrates each approach with concrete JavaScript code examples.

Build ToolsCommonJSES6
0 likes · 16 min read
A Review of Frontend Moduleization Development and Tooling