设置VS代码AutoImports操作以使用ES语法
我正在使用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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用此插件用于自动导入。也许这个插件也会为您提供帮助。
I use this plugin for auto import. Maybe this plugin will help you too.