Struggling to package a React components library for my Next.js app, I'm faced with an elusive error that has left me perplexed. Despite experimenting with Rollup configurations, TypeScript compiler settings, and various tweaks to the package.json file over the past few days, I find myself at a loss. It seems like there's a missing piece of knowledge or experience on my end as I struggle to decipher the cryptic messages in the error log.
Server Error
Error: Cannot find module '/home/ola/Projects/lifeitself/flowershow/node_modules/.pnpm/file+packages+core+flowershow-core-0.0.4.tgz_wwvq4sry3mrfcince3djb3idna/node_modules/next/link' imported from /home/ola/Projects/lifeitself/flowershow/node_modules/.pnpm/file+packages+core+flowershow-core-0.0.4.tgz_wwvq4sry3mrfcince3djb3idna/node_modules/@flowershow/core/dist/index2.js
Did you mean to import <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7b9b2afa397e6e4f9e7f9e1">[email protected]</a>_biqbaboplfbrettd7655fr4n2y/node_modules/next/link.js?
This error occurred during page generation. View console logs in the terminal window.
Call Stack
new NodeError
node:internal/errors (387:5)
...
Context:
@flowershow/core
is the TypeScript-written components library package@flowershow/core
acts as a dependency for`@flowershow/template- The monorepo, integrated with Nx (https://github.com/flowershow/flowershow), consists of both the
core
and thetemplate
packages structured as follows:
flowershow
├── packages
│ ├── ...
│ ├── core
| | ├── src
| | ├── project.json (Nx file)
| | ├── tsconfig.json
| | └── package.json
│ └── template
| ├── ... typical Next.js app contents
| ├── project.json (Nx file)
| └── package.json
├── nx.json
├── package.json
├── pnpm-workspace.yaml
└── tsconfig.base.json
Relevant config files of @flowershow/core
package.json
:
{
"name": "@flowershow/core",
"version": "0.0.4",
"description": "Core Flowershow components, configs and utils.",
"repository": {
"type": "git",
"url": "git+https://github.com/flowershow/flowershow.git",
"directory": "packages/core"
},
"author": "Rufus Pollock",
"license": "MIT",
"bugs": {
"url": "https://github.com/flowershow/flowershow/issues"
},
"homepage": "https://github.com/flowershow/flowershow#readme",
"publishConfig": {
"access": "public"
},
"type": "module",
"main": "./dist/index.js",
"dependencies": {
"@docsearch/react": "^3.3.0",
...
}