I am currently working with a Vue Single File Component that has two <script>
blocks: one for setup and another for Vue Router's beforeRouteEnter
handler, which cannot be used in setup. Both blocks may require some of the same imports. Interestingly, when I run npm run dev
, each script block needs to import the required module independently, but when I run npm run build
, the TypeScript compiler (or linter) throws an error:
src/components/MyComponent.vue:72:8 - error TS2300: Duplicate identifier 'auth'.
import auth from '@/auth'
I am seeking advice on the best approach to resolve this issue. Any insights would be appreciated.