Example:
Node 14 didn't support ECMAScript module. So now Node 16 supports them.
import * as fs from "fs" // Let's use an ECMA Script
Before (Node 14):
const fs = require('fs')
Take Aways:
- Use node 16
- Use ES imports instead of commonjs imports
- import * as fs from ‘fs’ ----- const fs = require(‘fs’)
'Coding Languages > JavaScript' 카테고리의 다른 글
[JavaScript] Promise (0) | 2022.05.19 |
---|---|
[JavaScript] Scheduling: setTimeout and setInterval (0) | 2022.04.30 |
[JavaScript] Strict inequality (!==) (0) | 2022.04.23 |
[JavaScript] Map (0) | 2022.04.20 |
[JavaScript] double exclamation mark (!!) (0) | 2022.04.19 |