Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

databaseDefaultSerializer exported incorrecly #1481

Closed
tlserver opened this issue Jan 5, 2024 · 1 comment · Fixed by #1482
Closed

databaseDefaultSerializer exported incorrecly #1481

tlserver opened this issue Jan 5, 2024 · 1 comment · Fixed by #1482
Labels

Comments

@tlserver
Copy link
Contributor

tlserver commented Jan 5, 2024

Reproduction

Please find the reproduction example in this codesandbox.

Unfortunately, there is no option to make it writable to the public. To edit, please sign in and fork the sandbox.

Steps to reproduce the bug

  1. Add the following import statement to your code:
    import { databaseDefaultSerializer } from "vuefire";
  2. It fails on page loaded.

Expected behavior

The import statement should successfully import the createRecordFromDatabaseSnapshot() function because, in dist/index.d.mts:21 (version 3.1.21, which may vary in other versions), it is defined and exported as databaseDefaultSerializer:

// line 21
declare function createRecordFromDatabaseSnapshot(/* ... */): /* ... */;

// line 726
export { /* ... */, createRecordFromDatabaseSnapshot as databaseDefaultSerializer, /* ... */ };

Actual behavior

An error is thrown with the following message:

Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/vuefire.js?v=05c98cd7' does not provide an export named 'databaseDefaultSerializer'

This error message does not appear in the CodeSandbox console but is shown in the browser console.
image

Additional Information

A search for databaseDefaultSerializer in dist/index.mjs returns no matches. It appears that the aliasing of createRecordFromDatabaseSnapshot as databaseDefaultSerializer is mistakenly placed within a type export block in src/index.ts:24-30:

export type {
  DatabaseSnapshotSerializer,
  _RefDatabase,
  VueDatabaseDocumentData,
  VueDatabaseQueryData,
  createRecordFromDatabaseSnapshot as databaseDefaultSerializer,
} from './database/utils'

Should it not be included in a regular export instead?

export {
  createRecordFromDatabaseSnapshot as databaseDefaultSerializer,
} from './database/utils'
@posva
Copy link
Member

posva commented Jan 5, 2024

Yes, it shouldn’t be a type 😅
Feel free to open the PR since you already found the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants