Building a Better Web
June 11–12, 2018: Training
June 12–14, 2018: Tutorials & Conference
San Jose, CA

The future of JavaScript modules

C J Silverio (npm)
9:00am–9:40am Thursday, June 14, 2018
Future JS and Functional
Location: 210 B/F
Secondary topics:  Developer Experience Track: Tools, Platforms, and Techniques, High-level, Technical
Average rating: ****.
(4.44, 9 ratings)

Who is this presentation for?

  • Web developers

Prerequisite knowledge

  • A basic understanding of JavaScript development workflows, either targeting the backend with Node.js or targeting the browser
  • A working knowledge of using npm packages, JavaScript bundling, and transpilation tools like Babel

What you'll learn

  • Learn how ECMAScript modules differ from CommonJS modules, how the JavaScript language is changing to accommodate a new module system, key ways in which the systems differ from each other, and how to use code written in the old system in the new system

Description

Until now, JavaScript has not had an official module system defined as part of the language, although it has had several unofficial ones, including Node.js’s CommonJS module system. JavaScript developers have nearly universally adopted Node.js as the platform of choice for their tooling. Web application frameworks all use command-line tools written in Node.js, pulling shared code from the npm registry to build applications that run on the browser. While CommonJS modules do not work in the browser, bundling tools like browserify and webpack have allowed CommonJS modules to be built into browser-ready code.

But JavaScript in browsers has a new module system: ES modules. With the arrival of browser support for ES modules, developers now expect to be able to write ESM code and have it work everywhere. Early implementations of ES modules rely on the CommonJS module system under the hood with Babel transpiling ESM syntax into CommonJS syntax. The two module systems are incompatible in several interesting ways, but Babel has hidden the differences.

Join CJ Silverio to explore ES modules and learn what’s new, what you need to know about how to use the new system, and what you need to know to use all the JavaScript that already exists from your new code.

Photo of C J Silverio

C J Silverio

npm

CJ Silverio is the CTO of npm. Her work allows JavaScript developers all over the world to share code and build modern web applications.