Skip to content

databaseDefaultSerializer exported incorrecly #1481

Closed
@tlserver

Description

@tlserver

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions