Skip to content

Commit 7ef69fa

Browse files
ermauliksyangshun
andauthored
Update module differences in documentation (#45)
Co-authored-by: Yangshun Tay <tay.yang.shun@gmail.com>
1 parent 85a7c27 commit 7ef69fa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • questions/explain-the-differences-between-commonjs-modules-and-es-modules

questions/explain-the-differences-between-commonjs-modules-and-es-modules/en-US.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ console.log(value); // 42
3636
| Module Syntax | `require()` for importing `module.exports` for exporting | `import` for importing `export` for exporting |
3737
| Environment | Primarily used in Node.js for server-side development | Designed for both browser and server-side JavaScript (Node.js) |
3838
| Loading | Synchronous loading of modules | Asynchronous loading of modules |
39-
| Structure | Dynamic imports, can be conditionally called | Static imports/exports at the top level |
39+
| Structure | Dynamic imports, can be conditionally called | ES modules use static top-level import/export statements, while dynamic loading is supported separately via the `import()` |
4040
| File extensions | `.js` (default) | `.mjs` or `.js` (with `type: "module"` in `package.json`) |
4141
| Browser support | Not natively supported in browsers | Natively supported in modern browsers |
4242
| Optimization | Limited optimization due to dynamic nature | Allows for optimizations like tree-shaking due to static structure |

0 commit comments

Comments
 (0)