Skip to content

create-react-app bundle bug #2

Description

@jchris

For some reason create react app isn't "seeing through" the use-fireproof dependency to grab @fireproof/core properly.

Instead you have to initialize and pass in your own database and index objects. This incantation will work anywhere, but is a required workaround for CRA:

import { useFireproof } from 'use-fireproof'
import { fireproof, index } from '@fireproof/core'
function App() {
  const { database, useLiveQuery } = useFireproof(fireproof('legendary'))
  const sorted = useLiveQuery(index(database, 'sort'))

In normal application, you can omit the fireproof() and index() wrapper and useFireproof and useLiveQuery will just do the correct thing. See #1 about fixing the build bundle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions