📘default export
JS ⟩ module ⟩ ES ⟩ export ⟩ export default
export default is used if only one variable is being exported from a file, also used to create a fallback value for a file or module.
unlike CommonJS, default export in ES module cannot be destructured❗️ 👉 example:es module
// "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
Was this helpful?