我正在尝试导入myArr
from hello.js into index.js。但是我得到一个错误
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module
File hello.js
export let myArr = ['hello', 'hi', 'hey'];
File index.js
import { myArr } from './hello.js';
console.log(myArr);
我哪里错了?
使用版本2:
npm install node-fetch@2
节点获取v3 中的模块是仅 ESM 模块 - 您无法使用以下命令导入它要求().
如果您无法切换到 ESM,请使用仍兼容的 v2CommonJS。 v2 的关键错误修复将继续发布。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)