Skip to content

FEATURE: Config option to automatically import emulator data on start #14

@Soviut

Description

@Soviut

Problem

I would like to import existing data into the Firebase emulators on start. Currently, there is no option in vite-plugin-firebase to do this.

Details

Local emulator data can be exported while the emulators are running with

npx firebase emulators:export <dir>

You can then import the data when the emulators start with

npx firebase emulators:start --import=<dir>

Solution

Add a config option that allows the import directory be specified. If the option exists, perform the import.

firebasePlugin({
  projectName: 'whatever',
  projectId: 'whatever-12345',
  targets: ['firestore', 'functions', 'storage'],
  showUI: true,
  importPath: './data' // <--
}),

Workarounds

You can import while the emulators are running with the following, but it's inconvenient to have to always run two commands.

npx firebase emulators:exec --import=<dir>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions