【发布时间】:2019-08-15 15:07:14
【问题描述】:
以下是我在 GitHub 上的项目位置:
https://github.com/nandy2013/MERN-Stack-Dev
我只是想将 js 文件中的方法导入另一个具有以下实现的 js 文件:
is-empty.js
const isEmpty = value =>
value === undefined ||
value === NULL ||
(typeof value === 'object' && Object.keys(vale).length === 0) ||
(typeof value === 'string' && value.trim().length === 0);
module.exports = isEmpty;
register.js
//code
import isEmpty from './is-empty';
//code
片段:
C:\Users\1217688\Desktop\devconnector\validation\register.js:2 导入 isEmpty from './is-empty'; ^^^^^^
SyntaxError:意外的令牌导入 在新脚本 (vm.js:51:7) 在 createScript (vm.js:138:10) 在 Object.runInThisContext (vm.js:199:10) 在 Module._compile (module.js:624:28) 在 Object.Module._extensions..js (module.js:671:10) 在 Module.load (module.js:573:32) 在 tryModuleLoad (module.js:513:12) 在 Function.Module._load (module.js:505:3)
请帮忙!
【问题讨论】: