I created a class:
import FirestoreManager from './FirestoreManager';
import type { ArtworkType } from '~/utils';
const DB_NAME = 'artworks';
class ArtworkManager extends FirestoreManager<ArtworkType> {
static instance: ArtworkManager;
constructor(dbName: string) {
if (ArtworkManager.instance) {
return ArtworkManager.instance;
}
super(dbName);
ArtworkManager.instance = this;
}
// Método estático para obtener la instancia
static getInstance() {
if (!ArtworkManager.instance) {
ArtworkManager.instance = new ArtworkManager(DB_NAME);
}
return ArtworkManager.instance;
}
}
export { ArtworkManager }
To get autoimport in ~/utils/index.ts I exported it:
export { ArtworkManager } from './firebase/firestore/ArtworkManager';
Describe the bug
The problem that I have is importing a class (singleton) from utils.
I got this error:
It autoimports the class itself.
If I remove the export from ~/utils/index.ts I got:
The requested module '/_nuxt/utils/index.ts?t=1711549824227' does not provide an export named 'ArtworkManager'
Additional context
I tried to move the 'ArtworkManager' class to ~/utils/ root, but I got the same results.
Question
Is it the correct way to do it? If not, what is the correct way to autoimport a class?
Link to Github reported as bug: https://github.com/nuxt/nuxt/issues/26516