Closed roboflank closed 7 years ago
Can you share your script?
Am just using the Demo script.
On Thu, Sep 28, 2017, 5:02 PM Elias Hussary notifications@github.com wrote:
Can you share your script?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eliashussary/nutrition-facts/issues/1#issuecomment-332846089, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOuF2Nc8DWfUT0m5JmWOlwhAW0i6mtdks5sm6cMgaJpZM4Pm0Bo .
Okay, it was written using es6 modules oppose to commonjs.
Ensure you are importing/requiring correctly, notice the .default
on my require statement.
// es6
import NutritionFacts from 'nutrition-facts'
// commonjs
const NutritionFacts = require('nutrition-facts').default
Thanks :)
On Thu, Sep 28, 2017 at 7:04 PM, Elias Hussary notifications@github.com wrote:
Okay, it was written using es6 modules oppose to commonjs.
Ensure you are importing/requiring correctly, notice the .default on my require statement.
// es6import NutritionFacts from 'nutrition-facts' // commonjsconst NutritionFacts = require('nutrition-facts').default
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/eliashussary/nutrition-facts/issues/1#issuecomment-332884192, or mute the thread https://github.com/notifications/unsubscribe-auth/AGOuF9Ecz9hqQyJFwjFoMcFkDRHOBV_Aks5sm8N2gaJpZM4Pm0Bo .
const NF = new NutritionFacts(process.env.USDA_NDB_API_KEY);
^
TypeError: NutritionFacts is not a constructor
Am running into the above error. Any work around?