Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Need Support for ES6 Module -> (Error [ERR_REQUIRE_ESM]: require() of ES Module) #80

Open
wyyr opened this issue Nov 22, 2023 · 0 comments

Comments

@wyyr
Copy link

wyyr commented Nov 22, 2023

Hey, I'm done searching for firestore migration, and just found this great tools. But seems only support for CommonJS.

Can I use ES6 module import ? because I faced this error when i'm using ES6 Module import.

Screenshot 2023-11-22 203555

v0.0.1__foods.js

import * as fs from 'fs';
import * as path from 'path';

async function migrate({ firestore, FieldValue }) {
  const foods = JSON.parse(fs.readFileSync(path.resolve('src/seeds/foods.json')));

  foods.forEach(async (item) => {
    await firestore.collection('foods').doc(item.id).set(item);
  });
}

export default migrate;
@wyyr wyyr changed the title Need Support for ES6 Module Need Support for ES6 Module -> (Error [ERR_REQUIRE_ESM]: require() of ES Module) Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant