How to use the find-babel-config.then function in find-babel-config

To help you get started, we’ve selected a few find-babel-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github egoist / vue-compile / src / script-compilers / babel.ts View on Github external
export const compile = async (code: string, { filename, modern, babelrc }: ScriptCompilerContext): Promise => {
  const cwd = path.dirname(filename)
  const file =
    babelrc === false ?
      null :
      cache.get(cwd) ||
        (require('find-babel-config')(cwd).then((res: any) => res.file))

  cache.set(cwd, file)

  const config: TransformOptions = {
    filename,
    presets: [
      [
        require.resolve('../babel/preset'),
        {
          modern
        }
      ]
    ]
  }

  if (file) {

find-babel-config

Find the closest babel config based on a directory

MIT
Latest version published 20 days ago

Package Health Score

80 / 100
Full package analysis

Popular find-babel-config functions