dayjs
dayjs copied to clipboard
Module not found: Error: Can't resolve 'dayjs'
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/<project_name>/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/<project_name>/esm2022/src/lib/date-input/src/shared'
./node_modules/<project_name>/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/<project_name>/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
@uganjha did you solve this? I have the same problem
npm install dayjs solved my problem