dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

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

Open uganjha opened this issue 2 years ago • 2 comments

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 avatar Jul 02 '23 10:07 uganjha

@uganjha did you solve this? I have the same problem

martinjagodic avatar Nov 10 '23 08:11 martinjagodic

npm install dayjs solved my problem

AmirMehr avatar Mar 07 '24 07:03 AmirMehr