ES7 如何在节点中导入模块的对象.js


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

如何使用ES2017的方式来编写它?我试着

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

但它不能工作

怎么用ES7写呢?由于

这是包裹。json文件,它将类型设置为模块。所以我不能使用const…=require('…')

{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "nodemon index.js"
},
import { Strategy } from 'passport-google-oauth20';

最新更新