Named export 'xxx' not found❗️

JSerrorSyntaxError ⟩ Named export 'xxx' not found

// ⭐️ To use this file as an ES module,
//    add this line to "package.json".
// -----------------------------------------------------------------
//
//     "type": "module",
//
// -----------------------------------------------------------------

// import {days as dayNames} from "date-names";
//         ^^^^
// -----------------------------------------------------------------
// ⛔ SyntaxError: Named export 'days' not found. 
// -----------------------------------------------------------------
// - The requested module 'date-names' is a CommonJS module, 
//   which may not support all module.exports as named exports.
//
// - CommonJS modules can always be imported via the default export, 
//   for example using:
//
//       import pkg from 'date-names';
//       const {days: dayNames} = pkg;
//
// -----------------------------------------------------------------

import pkg from 'date-names';    // import package from npm
const {days: dayNames} = pkg;

console.log(dayNames.length);    // 7

Last updated