我有一个Vue SFC,有两个<script>
块:一个用于设置,另一个用于vue router的beforeRouteEnter
处理程序,不能在设置中使用.它们可能使用相同的进口产品.当运行npm run dev
时,它要求每个脚本块独立于其他块导入它,但是当运行npm run build
时,typescript编译器(或linter)抛出一个错误:
src/components/MyComponent.vue:72:8 - error TS2300: Duplicate identifier 'auth'.
import auth from '@/auth'
处理这个问题的正确方法是什么?