Skip to content

Commit

Permalink
fix(vue-router-bridge): fix cannot default import (#14)
Browse files Browse the repository at this point in the history
* fix(vue-router-bridge): fix cannot default import

* fix: unit test
  • Loading branch information
kazupon authored Jan 7, 2022
1 parent 1ecc7b2 commit 2eacc10
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/vue-router-vue3/test/vue-router-4.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { default as VueRouter, isVueRouter3, isVueRouter4 } from '@intlify/vue-router-bridge'

test('vue-router-bridge for vue3', () => {
assert.isUndefined(VueRouter)
assert.isDefined(VueRouter)
assert.ok(!isVueRouter3)
assert.ok(isVueRouter4)
})
5 changes: 4 additions & 1 deletion packages/vue-router-bridge/lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Object.keys(VueRouter).forEach(function (key) {
exports[key] = VueRouter[key]
})

exports.default = undefined
// dummy vue-router 3 class
class VueRouter3 {}

exports.default = VueRouter3
exports.isVueRouter3 = false
exports.isVueRouter4 = true
5 changes: 5 additions & 0 deletions packages/vue-router-bridge/lib/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ import { useRouter, useRoute } from 'vue-router'
var isVueRouter3 = false
var isVueRouter4 = true

// dummy vue-router 3 class
class VueRouter3 {}

export * from 'vue-router'
export { useRouter, useRoute, isVueRouter3, isVueRouter4 }

export default VueRouter3
5 changes: 4 additions & 1 deletion packages/vue-router-bridge/lib/v4/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Object.keys(VueRouter).forEach(function (key) {
exports[key] = VueRouter[key]
})

exports.default = undefined
// dummy vue-router 3 class
class VueRouter3 {}

exports.default = VueRouter3
exports.isVueRouter3 = false
exports.isVueRouter4 = true
5 changes: 5 additions & 0 deletions packages/vue-router-bridge/lib/v4/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ import { useRouter, useRoute } from 'vue-router'
var isVueRouter3 = false
var isVueRouter4 = true

// dummy vue-router 3 class
class VueRouter3 {}

export * from 'vue-router'
export { useRouter, useRoute, isVueRouter3, isVueRouter4 }

export default VueRouter3

0 comments on commit 2eacc10

Please sign in to comment.