Upon running npm run build
for my sveltekit project, I encountered the following error generated by vite
:
7:55:49 PM [vite-plugin-svelte] When trying to import svelte components from a package, an error occurred due to missing `package.json` files. Contact the author to resolve this issue.
- firebase-admin
✓ 47 modules transformed.
[commonjs] No known conditions found for "./standalone" entry in "@firebase/database-compat" package
> No known conditions found for "./standalone" entry in "@firebase/database-compat" package
Error: No known conditions found for "./standalone" entry in "@firebase/database-compat" package
at bail (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:29712:8)
at resolve$1 (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:29768:32)
at resolveExports (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30285:12)
at resolveDeepImport (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30301:26)
at tryNodeResolve (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:30043:11)
at Object.resolveId (/home/vincent/repos/sveltekit/node_modules/vite/dist/node/chunks/dep-e0fe87f8.js:29910:28)
at /home/vincent/repos/sveltekit/node_modules/rollup/dist/shared/rollup.js:22697:251
After checking in the node_modules
, it was confirmed that the package @firebase/database-compat
does export its package.json file. This is perplexing.
Below is my package.json
:
{
"private": true,
"type": "module",
"scripts": {
"dev": "svelte-kit dev",
"build": "svelte-kit build --verbose",
"preview": "svelte-kit preview"
},
"devDependencies": {
"@sveltejs/adapter-vercel": "next",
"@sveltejs/kit": "next",
"@tsconfig/svelte": "^2.0.1",
"@types/body-parser": "^1.19.1",
"@types/cookie": "^0.4.1",
"sass": "^1.39.2",
"svelte": "^3.38.3",
"typescript": "^4.4.3"
},
"dependencies": {
"body-parser": "^1.19.0",
"cookie": "^0.4.1",
"firebase": "^9.4.1",
"firebase-admin": "^10.0.0",
"prettier": "^2.3.2",
"prettier-plugin-svelte": "^2.3.1",
"svelte-preprocess": "^4.9.4"
},
"prettier": {
"arrowParens": "always",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "none"
}
}