{"id":20698967,"url":"https://github.com/doomsower/vite-mono-test","last_synced_at":"2026-04-22T02:32:44.313Z","repository":{"id":71628338,"uuid":"427734281","full_name":"doomsower/vite-mono-test","owner":"doomsower","description":null,"archived":false,"fork":false,"pushed_at":"2021-11-13T18:04:09.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-25T13:45:52.072Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doomsower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-13T17:49:21.000Z","updated_at":"2021-11-13T18:04:11.000Z","dependencies_parsed_at":"2023-05-13T01:30:23.053Z","dependency_job_id":null,"html_url":"https://github.com/doomsower/vite-mono-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/doomsower/vite-mono-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fvite-mono-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fvite-mono-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fvite-mono-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fvite-mono-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doomsower","download_url":"https://codeload.github.com/doomsower/vite-mono-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fvite-mono-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32118108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-22T00:31:26.853Z","status":"online","status_checked_at":"2026-04-22T02:00:05.693Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T00:27:36.007Z","updated_at":"2026-04-22T02:32:44.297Z","avatar_url":"https://github.com/doomsower.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Problem with Vite and CommonJS package in monorepo\n\nIn this repo we have basic monorepo with 3 packages\n\n- Vite app (`/packages/app`)\n- CommonJS library (`/packages/lib-cjs`)\n- ESM Library (`/packages/lib-esm`)\n\nVite app depends on both libraries and also a copy of CommonJS library is installed from github (https://github.com/doomsower/vite-cjs-test-lib)\n\nVite app builds and launches successfully if I use ESM library or CommonJS library from github.  \nHovewer, with local cjs library ([import statement](https://github.com/doomsower/vite-mono-test/blob/master/packages/app/src/App.tsx#L4)) `vite build` fails with error:\n\n`'test' is not exported by ../lib-cjs/dist/index.js, imported by src/App.tsx`\n\nI tried various modification to `vite.config.ts` but none seem to work\n\n\u003cdetails\u003e\n  \u003csummary\u003eFull error log\u003c/summary\u003e\n  \n  ```\n  pnpm build                                                                          20:56:16 \n  \n  \u003e @vite-mono/app@0.0.0 build /Volumes/Projects/_temp/vite-mono/packages/app\n  \u003e tsc \u0026\u0026 vite build\n  \n  vite v2.6.14 building for production...\n  transforming (30) ../../node_modules/.pnpm/scheduler@0.20.2/node_modules/scheduler/cjs/scheduler.production.min.jsError when using sourcemap for reporting an error:   Can't resolve original location of error.\n  ✓ 34 modules transformed.\n  'test' is not exported by ../lib-cjs/dist/index.js, imported by src/App.tsx\n  file: /Volumes/Projects/_temp/vite-mono/packages/app/src/App.tsx:4:9\n  2: import logo from \"./logo.svg\";\n  3: import \"./App.css\";\n  4: import { test } from \"@vite-mono/lib-cjs\";\n              ^\n  5: import { jsx as _jsx } from \"react/jsx-runtime\";\n  6: import { jsxs as _jsxs } from \"react/jsx-runtime\";\n  error during build:\n  Error: 'test' is not exported by ../lib-cjs/dist/index.js, imported by src/App.tsx\n      at error (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:158:30)\n      at Module.error (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:12382:16)\n      at Module.traceVariable (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:12767:29)\n      at ModuleScope.findVariable (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:11559:39)\n      at FunctionScope.findVariable (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:6930:38)\n      at ChildScope.findVariable (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:6930:38)\n      at Identifier.bind (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:6419:40)\n      at CallExpression.bind (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:5025:23)\n      at CallExpression.bind (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:9396:15)\n      at TemplateLiteral.bind (/Volumes/Projects/_temp/vite-mono/node_modules/.pnpm/rollup@2.60.0/node_modules/rollup/dist/shared/rollup.js:5021:31)\n   ELIFECYCLE  Command failed with exit code 1.\n  ```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003ePnpm links\u003c/summary\u003e\n\n```\nls -la node_modules/@vite-mono                                                        20:49:33 \ntotal 24\ndrwxr-xr-x   5 doomsower  admin  170 Nov 13 20:47 .\ndrwxr-xr-x  11 doomsower  admin  374 Nov 13 20:47 ..\nlrwxr-xr-x   1 doomsower  admin   16 Nov 13 19:37 lib-cjs -\u003e ../../../lib-cjs\nlrwxr-xr-x   1 doomsower  admin  149 Nov 13 20:47 lib-cjs-remote -\u003e ../../../../node_modules/.pnpm/github.com+doomsower+vite-cjs-test-lib@8c6e40dc2c8098d23a84f498dd1022d30f03ef3c/node_modules/@vite-mono/lib-cjs-remote\nlrwxr-xr-x   1 doomsower  admin   16 Nov 13 19:37 lib-esm -\u003e ../../../lib-esm\n```\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Fvite-mono-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoomsower%2Fvite-mono-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Fvite-mono-test/lists"}