question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES6 Modules with grant

See original GitHub issue

Hi. Thanks for making grant. I tried it and it works well for many OAuth2 providers.

One question I had was regarding support for ES Modules. While I understand from the issues that you have decided not to support Typescript, I was wondering how to import grant as a ES6 module.

While require('grant').fastify(); works, I wanted to go the standard route since require is not a standard and definitely not recommended in the future for Node.js with mjs support now in place.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
simovcommented, Nov 17, 2020

Thanks for the help @tvvignesh, I really appreciate it 👍

1reaction
simovcommented, Nov 17, 2020

Ok, published v5.4.8 with the last two fixes. You should be able to use the strict option now without patching the GrantConfig. As for the esModuleInterop that totally makes sense, I used that option myself, but I also added the .default import that you suggested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript ES6 Modules Import Export
ES6 Module import export business in JavaScript and JS Legacy Code ... JS will take this for granted and you can run the...
Read more >
Include es6 module support · Issue #97 · nodeca/pako - GitHub
All modern browsers now support es6 modules (except chrome which will land shortly). ... Granted these may be more "bleading-edge" than "modern".
Read more >
ES Modules in Cloud Functions - Medium
ES modules (aka ECMAScript modules or ESM) are a TC39 standard, unflagged feature in Node≥14 for loading JavaScript modules.
Read more >
JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >
How to use an ES modules aggregator file - Educative.io
An aggregator file is a script we solely use to import and re-export the exported items of other modules. In other words, instead...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found