【发布时间】:2019-08-05 01:11:54
【问题描述】:
如果某些 JS 代码有这个
import("path/to/file.js")
然后 file.js 有这个
export default async function() {
// I want to get "path/to" here
return {};
}
如何获取file.js所在的目录?
【问题讨论】:
-
this 做你想做的事吗?
-
动态导入是没用的,因为导出不会等待它们。
-
没有帮助,但我想通了。
import.meta.url
标签: javascript import export es6-modules