From Python Packages to JavaScript Modules: ESM and CommonJS (Summary)

Dev’s three-plant digest now runs as JavaScript modules, and node digest.js logs/week-12 prints the Python tool’s report.

In this course, you learned how to:

  • Give a folder an index.js front door and import it by its full path
  • Import across a project with ../ paths or # names from package.json
  • Find files next to a module with import.meta and import JSON with with { type: "json" }
  • Change a module’s state through a function it exports
  • Load a module on demand, or by name, with await import()
  • Read CommonJS and use a CommonJS file with a .cjs extension

Keep and Drop Your Python Habits

Python’s package design carries over, but how files find each other and who may change a value don’t. Each of these habits misfired in the course:

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.