

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 6
click for more info
Not enough gems
Cost: 6 gems
1: Modules
incomplete
2: CommonJS
incomplete
3: Strict Mode
incomplete
4: ES6 Modules
incomplete
5: Node.js Modules
incomplete
6: Browser Modules
incomplete
7: Default Exports
incomplete
8: Bundlers
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
By default, Node.js uses the CommonJS syntax for modules. There are two ways you can manually switch to ES6 module syntax:
"type": "module" to your package.json file.mjs instead of .jsPersonally, I prefer the first option. It's cleaner and easier to manage. And remember, if you're not using ES6 modules, your code will not be in strict mode by default!
Let's do what the JavaScript system should have done years ago and migrate our code from CommonJS to ES6 modules.
Run and submit the CLI tests.