HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/node_modules/@vue/vue-loader-v15/lib/compiler.js
// resolve compilers to use.

let cached

exports.resolveCompiler = function (ctx, loaderContext) {
  if (cached) {
    return cached
  }

  // check 2.7
  try {
    const pkg = loadFromContext('vue/package.json', ctx)
    const [major, minor] = pkg.version.split('.')
    if (major === '2' && Number(minor) >= 7) {
      return (cached = {
        is27: true,
        compiler: loadFromContext('vue/compiler-sfc', ctx),
        templateCompiler: undefined
      })
    }
  } catch (e) {}

  return (cached = {
    compiler: require('@vue/component-compiler-utils'),
    templateCompiler: loadTemplateCompiler(ctx, loaderContext)
  })
}

function loadFromContext(path, ctx) {
  return require(require.resolve(path, {
    paths: [ctx]
  }))
}

function loadTemplateCompiler(ctx, loaderContext) {
  try {
    return loadFromContext('vue-template-compiler', ctx)
  } catch (e) {
    if (loaderContext) {
      if (/version mismatch/.test(e.toString())) {
        loaderContext.emitError(e)
      } else {
        loaderContext.emitError(
          new Error(
            `[vue-loader] vue-template-compiler must be installed as a peer dependency, ` +
              `or a compatible compiler implementation must be passed via options.`
          )
        )
      }
    } else {
      throw e
    }
  }
}