iamkun / iamkun/dayjs

Module not found: Error: Can't resolve 'dayjs'

Open
#2,365 4 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
While creating a project I have used dayjs as

`import dayjs from 'dayjs';
`
I have added dayjs in peerDependencies of my project.
While it works perfectly in the same project but once I have created a npm build out of it and publish the npm build and tried to use that build in some another project I am getting below error

```
./node_modules//esm2022/src/lib/date-input/src/shared/date.utils.mjs:3:0-26 - Error: Module not found: Error: Can't resolve 'dayjs' in '/node_modules//esm2022/src/lib/date-input/src/shared'

./node_modules//esm2022/src/lib/date-input/src/shared/date.utils.mjs:4:0-63 - Error: Module not found: Error: Can't resolve 'dayjs/plugin/customParseFormat' in 'node_modules//esm2022/src/lib/date-input/src/shared'
```
Not sure what I am missing.

**Expected behavior**
It should install dayjs in targeted project as it is mentioned in peerDependencies.

**Information**
- Day.js Version: 1.11.8
- OS: [e.g. iOS]: MacOs Monterey
- Browser [e.g. chrome 62]: Chrome

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.