0
var GoogleStrategy = require('passport-google-oauth20').Strategy;

How can I use ES2017's way to write it? I try

import GoogleStrategy from ('passport-google-oauth20').Strategy

But it couldn't work

How can I use ES7 to write it? Thanks

here is the package.json file, It set the type as module. So I couldn't use const...=require('...')

{
  "name": "server",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "start": "nodemon index.js"
  },

1 Answers1

0
import { Strategy } from 'passport-google-oauth20';
Eric Fortis
  • 16,372
  • 6
  • 41
  • 62