

babelrc.json are parsed as JSON5 and should contain an object matching Supported file extensions īabel can be configured using any file extension natively supported by Node.js, as mentioned in Configuration File Types section:ī and. Since Babel will not find the config file if the working directory isn't correct. Section above, this may then require explicitly setting "configFile" Given that, it may be more desirable to rename the. Unfortunately, this approach can be a bit repetitive, and depending on how Babel is being used, These cases will primarily cause issues for users with a monorepo structure, because if you Presets inside they were generally not installed, and may not even be valid in the version of babelrc files in node_modules dependencies would be detected, even though the plugins and babelrc files failed to apply to symlinked node_modules when people expected them to behave like normal dependencies. babelrc files applied to node_modules dependencies, often unexpectedly. These two restrictions were added to address common footguns in Babel 6.x: Users coming from Babel 6.x will likely trip up on these two edge cases, which are new in Babel 7.x.
#Find stretchly config file how to
See the monorepo documentation for more discussion on how to configure monorepos that have many packages.įile-relative configs can also be disabled by setting "babelrc" to false. babelrc.json files in packages that aren't Babel's 'root' are ignored unless you opt in babelrc.json files only apply to files within their own package "babelrcRoots" packages, or else searching will be skipped entirely. The "filename" being compiled must be inside of.Searching will stop once a directory containing a package.json is found, so a relative config.There are a few edge cases to consider when using a file-relative config: Project-wide config values, making them potentially useful for specific overrides, though that canĪlso be accomplished through "overrides".

File-relative configurations are also merged over top of This can be powerful because it allows you to create independent configurations for subsections ofĪ package. babelrc.json files, or an equivalent one using the supported extensions, by searching up theĭirectory structure starting from the "filename" being compiled (limited by the caveats below). File-relative configuration īabel loads. Project-wide configs can also be disabled by setting "configFile" to false. See the monorepo documentation for examples of how to use config files in that context. The primary downside of this project-wide config is that, because it relies on the workingĭirectory, it can be more painful to use in monorepos if the working directory is not the monorepo root. Which were traditionally quite painful to configure in Babel 6.x. Plugins and presets to easily apply to files in node_modules or in symlinked packages, "configFile" value to override the default config file search behavior.īecause project-wide config files are separated from the physical location of the configįile, they can be ideal for configuration that must apply broadly, even allowing For project-wide configuration, Babel will automatically searchįor a file, or an equivalent one using the supported extensions, New in Babel 7.x, Babel has a concept of a "root" directory, which defaults package.json files, with a "babel" key.babelrc.* files, with the following extensions. nfig.* files, with the following extensions.
