Module 11 ¡ Modules: import, export and How Files Find Each Other
Every Module Rule, One by One: Exports, Imports, Paths and the Two Systems
Free with an accountReading
Kenji moves a shop's code from one big file into twenty modules. On day one he meets six new error messages. One says a module "does not provide an export named" something. Another says it cannot find a module that is plainly there. Each message is a rule he did not know yet.
Checking what this lesson needs for youâĻ
What is inside Every Module Rule, One by One: Exports, Imports, Paths and the Two Systems
- Named exports
- An export list, with renaming
- The default export
- Named imports, renamed
- The default import
- The namespace import
- Re-exporting from another module
- The module scope: strict mode and no globals
- Top-level await
- How a browser loads a module
- How Node decides: ES module or CommonJS
- require and module.exports, in full
- Paths and file endings
- Dynamic import()
- ES modules against CommonJS