`module` field in package.json doesn't point to an esm module.
See original GitHub issueDescribe the bug
module field in package.json points to minified version of the library.
Also causes issues when using npm link across modules for development (minified file cannot be found / imported)
Expected behavior module field should point to the esm distribution so that it can be imported by consuming projects and tree-shaken / imported correctly.
Information
- Day.js Version 1.8.14
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Why is 'type: module' in package.json file? - Stack Overflow
When you have "type": "module" in the package.json file, your source code should use import syntax. When you do not have, you should...
Read more >How to Create a Hybrid NPM Module for ESM and CommonJS.
Creating an NPM module from single code base that easily targets both CommonJS and ES modules can be an exercise in frustration.
Read more >Using ES Modules (ESM) in Node.js: A Practical Guide (Part 1)
This is the simplest package, and demonstrates the basics of the basics. Let's start by exploring package.json , and the new exports field....
Read more >Using ES modules in Node.js - LogRocket Blog
Modules are independent building blocks of a software program. They are basically a design pattern that implements features of modular ...
Read more >CommonJS modules | Node.js v19.3.0 Documentation
CommonJS modules are the original way to package JavaScript code for Node.js. ... parent package.json file doesn't contain a top-level field "type" ....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

When I try to use dayjs/esm (import * as dayjs from ‘dayjs/esm’) or (import dayjs from ‘dayjs/esm’) in VS Code angular project it says
Ah okay - this is catching a few people out / deterring them from using the module.
Not sure if there is a “proper” fix for this as I’m no expert. I’ll switch to
dayjs/esmfor now.