How to use the loadPartialConfig function from @babel/core

Find comprehensive JavaScript @babel/core.loadPartialConfig code examples handpicked from public code repositorys.

77
78
79
80
81
82
83
84
85
86

if (argv.profile) {
    runtimeConfig.profile = true;
}

const partialConfig = babel.loadPartialConfig({
    /*
     * There are two types of babel configuration:
     * - project-wide configuration in babel.config.* files
     * - file-relative configuration in .babelrc.* files
fork icon201
star icon0
watch icon49

+ 2 other calls in file

39
40
41
42
43
44
45
46
47
48
49
  return ''
}


function getBabelConfig () {
  const { plugins = [] } = babel.loadOptions()
  const partialConfig = babel.loadPartialConfig()
  const targets = getTargetByConfig(partialConfig) || browserslist.loadConfig({ path: process.cwd() })
  const { list = [] } = coreJsCompat({ targets })
  return {
    list,
fork icon1
star icon17
watch icon0

28
29
30
31
32
33
34
35
36
37
function supportsCallerOption() {
  if (supportsCallerOptionFlag === undefined) {
    try {
      // Rather than try to match the Babel version, we just see if it throws
      // when passed a 'caller' flag, and use that to decide if it is supported.
      babel.loadPartialConfig({
        caller: undefined,
        babelrc: false,
        configFile: false
      });
fork icon0
star icon2
watch icon1

+ 2 other calls in file