设置VS代码AutoImports操作以使用ES语法

发布于 2025-02-09 12:32:33 字数 420 浏览 0 评论 0原文

我正在使用package.json的文件进行“ type”:“ Module” set的文件。当我从另一个文件输入导出名称时,自动port功能会自动为我写入导入语句;尽管我希望它使用ES模块语法编写导入语句。当前,它使用require导入它,这是我使用ES语法编写导出以来没有多大意义的。我如何获得这种行为的VS代码?

//示例。

export default function reader() {}

这是当前导入的工作方式 “

I'm working on a node project in VS Code with a package.json file that has the "type": "module" set. when I type in an export name from another file the autoImport functionality automatically writes the import statement for me; although I would like it to write the import statement using ES modules syntax. currently, it imports it using require which doesn't make much sense since I wrote the export using ES syntax. how do I get VS Code to behave this way?

// example.js

export default function reader() {}

this is how the import works currently
auto-import

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埋葬我深情 2025-02-16 12:32:33

我使用此插件用于自动导入。也许这个插件也会为您提供帮助。

I use this plugin for auto import. Maybe this plugin will help you too.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文