JavaScript importing¶
History of importing¶
- CommonJS
exports.myFunction = myFunction
const myFunction = require("myFile").myFunction
- how Node.js was
- AMD
- async module definitions
- Dojo
- ES Modules
Barrel files¶
import { Card } from "@src/Common/Components/Card";
import { SectionHeader } from "@src/Common/Components/SectionHeader";
- avoid using barrel files
- if you ever want to code split, import directly from the file
Last update:
2023-04-24