When I build my app for production everything works fine but in development I'm getting this error when I'm trying to import collection and addDoc from firestore. I've read that the problem is related to vite grabbing Firebase's browser (esm) bundle and not the Node bundle. I have tried to fix this by adding a vite.config.js file with the following content but nothing changed:
import { defineConfig } from 'vite';
import path from 'path';
// vite.config.js
export default defineConfig({
// config options
resolve: {
alias: {
['firebase/firestore']: path.resolve(__dirname, 'node_modules/firebase/firestore/dist/firestore/index.d.ts')
},extensions: ['.ts', '.js'] },
})