Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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) {