📘default export
// "default export" cannot be destructured
import { name } from './default_export.js'; // ⛔ error
// ^^^^
// ⛔ SyntaxError:
// The requested module './default_export.js'
// does not provide an export named 'name'// 📁 module.js
export default A; // ⭐️ export default
// ⭐️ import without `{}` ( not `{B}`❗️)
import B from "./module.js"; // ⭐️ use nay name of your choice
import defaultExport, {otherExport, ...} from "./module.js";// ⭐️ import "named export"
import { pi } from './named_export.js';
// ⭐️ import "default export"
import who from './default_export.js'; // OK
// ⭐️ "default export" cannot be destructured
//
// import { name } from './default_export.js'; // ⛔ error
// ^^^^
// ⛔ SyntaxError:
// The requested module './default_export.js'
// does not provide an export named 'name'Last updated