const path = require ( 'path' ) ; param { import ( '@babel/core' ) . ConfigAPI } api returns { import ( '@babel/core' ) . TransformOptions } function babelConfig ( api ) { const caller = api . caller ( ( caller ) => { return caller === null || caller === void 0 ? void 0 : caller . name ; } ) ; const isServer = caller === 'server' ; const absoluteRuntimePath = path . dirname ( require . resolve ( '@babel/runtime/package.json' ) ) ; return { overrides : [ { test : /\.ts$/ , plugins : [ [ require . resolve ( '@babel/plugin-transform-typescript' ) , { isTSX : false } ] ] , } , { test : /\.tsx$/ , plugins : [ [ require . resolve ( '@babel/plugin-transform-typescript' ) , { isTSX : true } ] ] , } , { test : /\.[jt]sx?$/ , plugins : [ require . resolve ( 'babel-plugin-macros' ) , [ require . resolve ( '@babel/plugin-transform-runtime' ) , { corejs : false , helpers : true , version : require ( '@babel/runtime/package.json' ) . version , regenerator : true , useESModules : true , absoluteRuntime : absoluteRuntimePath , } , ] , isServer ? require . resolve ( 'babel-plugin-dynamic-import-node' ) : require . resolve ( '@babel/plugin-syntax-dynamic-import' ) , require . resolve ( '@babel/plugin-transform-template-literals' ) , require . resolve ( '@babel/plugin-proposal-object-rest-spread' ) , require . resolve ( '@babel/plugin-proposal-nullish-coalescing-operator' ) , require . resolve ( '@babel/plugin-proposal-optional-chaining' ) , require . resolve ( '@babel/plugin-proposal-numeric-separator' ) , [ require . resolve ( '@babel/plugin-proposal-decorators' ) , { legacy : true } ] , [ require . resolve ( '@babel/plugin-proposal-class-properties' ) ] , [ require . resolve ( '@babel/plugin-proposal-private-methods' ) ] , ] , } , ] , presets : [ isServer ? [ require . resolve ( '@babel/preset-env' ) , { targets : { node : 'current' , } , } , ] : [ require . resolve ( '@babel/preset-env' ) , { useBuiltIns : 'entry' , loose : false , corejs : { version : '3.6' , proposals : true } , modules : false , exclude : [ 'transform-typeof-symbol' ] , } , ] , [ require . resolve ( '@babel/preset-react' ) , { runtime : 'automatic' } ] , require . resolve ( '@linaria/babel-preset' ) , ] , plugins : [ ] , } ; } module . exports = babelConfig ;