【发布时间】:2021-07-11 00:10:45
【问题描述】:
Vue CLI 正在放弃对无扩展导入的支持,而 Vetur 等 VS Code 扩展支持的各种功能不适用于无扩展导入。
我需要修改从 .vue 文件导入的每个默认组件,以在整个代码库中附加扩展名。由于文件数量众多,手动操作是不可行的,需要一些自动化的方法。
例子:
转弯:
import Baz from '@/components/Baz'
import Thing from './LocalThing'
import OtherThing from '../../OtherThing'
进入:
import Baz from '@/components/Baz.vue'
import Thing from './LocalThing.vue'
import OtherThing from '../../OtherThing.vue'
如何做到这一点?
【问题讨论】:
标签: javascript vue.js visual-studio-code refactoring es6-modules