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

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

Open
Soviut opened this issue Nov 4, 2022 · 0 comments
Open

Comments

@Soviut
Copy link

Soviut commented Nov 4, 2022

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant