'Cannot find module: '@sunilshrestha/ckeditor5-build-classic' while deploying MERN project to Heroku

In my project, I have custom built CKEditor 5. My project folder structure looks like this

enter image description here

When I run application locally, it works fine. But after I have deployed npm run build application to Heroku, build log in heroku websites shows error that:

./src/screens/PostEditScreen.js Cannot find module: '@sunilshrestha/ckeditor5-build-classic

I couldn't figure out how to deploy this custom built ckeditor5 to heroku where my frontend react app can use. The scripts in package.json file looks like this:

"scripts": {
    "start": "node backend/server",
    "build": "cd frontend && react-scripts build",
    "server": "nodemon backend/server",
    "client": "npm start --prefix frontend",
  "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix frontend && npm run build --prefix frontend",
    "predeploy": "npm run build",
    "deploy": "gh-pages -d build"

Package.json of frontend have dependencies for custom build ckeditor5 looks like this:

"@sunilshrestha/ckeditor5-build-classic": "file:../ckeditor5/packages/ckeditor5-build-classic",


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source