[英]I am using ES6 syntax for node.js and I have exported module but trying to import gives error Cannot find module
index.js索引.js
import { Time} from './service/passport';
passport.js护照.js
const Time = async () => {
console.log('done');
}
export { Time }
I am using EcmaScript or es6 in node.js but when I try to export above module it is giving me error Can't find module but I have exported module don't know why still getting error any help will be appreciated我在 node.js 中使用 EcmaScript 或 es6,但是当我尝试导出上面的模块时,它给了我错误无法找到模块但我已经导出模块不知道为什么仍然出现错误任何帮助将不胜感激
Need to add file extension only instead of只需要添加文件扩展名而不是
import { Time} from './service/passport';
use采用
import { Time} from './service/passport.js';
it will be done将会完成
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.