@finos/babel-preset-legend-studio

Legend Studio Babel preset

Usage no npm install needed!

<script type="module">
  import finosBabelPresetLegendStudio from 'https://cdn.skypack.dev/@finos/babel-preset-legend-studio';
</script>

README

@finos/babel-preset-legend-studio

This preset includes the following presets and plugins:

And with the development option:

React support adds:

Options

const { development, useTypescript, useReact, useBabelRuntime } = opts;

development

boolean, defaults to false

This toggles behavior specific to development:

  • React support will turn on fast-refresh for files with JSX.

useTypescript

boolean, defaults to false

This toggles support for Typescript. Note that babel does not do type-checking (i.e. it only strips away type annotations and transpile files to Javascript) nor generating type definition files.

useReact

boolean, defaults to false

This toggles support for React. Note that we use automatic for runtime option, which auto-import functions from React@17 that helps with transforming JSX.

useBabelRuntime

boolean, defaults to false

When enabled, Babel's injected helper code will be reused and not included in the bundled code, as such this helps save on bundle size. However, this requires @babel/runtime as a production dependency (since it's for the "runtime").

Note that this option is in useful only when we bundle code. As such, if we use other compiler to compile/transpile, we don't need this option.