postinstall.js 467 B

123456789101112131415
  1. const { switchVersion, loadModule } = require('./utils')
  2. const Vue = loadModule('vue')
  3. if (!Vue || typeof Vue.version !== 'string') {
  4. console.warn(
  5. '[vue3-sketch-ruler] Vue is not found. Please run "npm install vue" to install.'
  6. )
  7. } else if (Vue.version.startsWith('2.')) {
  8. switchVersion(2)
  9. } else if (Vue.version.startsWith('3.')) {
  10. switchVersion(3)
  11. } else {
  12. console.warn(
  13. `[vue3-sketch-ruler] Vue version v${Vue.version} is not suppported.`
  14. )
  15. }