UNPKG

@zohodesk/client_build_tool

Version:

A CLI tool to build web applications and client libraries

56 lines (28 loc) 3.1 kB
## Babel Customizations Configuration Documentation The `babelCustomizations` object in the provided code represents a set of customizations that can be applied to the Babel configuration within the context of the Client Build Tool (CBT). These customizations allow you to fine-tune how JavaScript code is transpiled and transformed during the build process. Below is the documentation for the individual customizations: ### babelCustomizations.browserList > Type: (null or string array) This configuration option allows you to define a custom `browserslist` for Babel, which specifies the targeted browsers and their versions. If set to `null`, the default `browserslist` of the environment will be used. ### babelCustomizations.removeAttribute This customization is used to remove specific HTML attributes from JSX elements during transpilation. - **enable** (boolean): Determines whether the removal of attributes is enabled (`true`) or not (`false`). - **options** (object): Contains settings related to attribute removal. - **attributeNames** (string array): Specifies the names of HTML attributes that should be removed from JSX elements during transpilation. ### babelCustomizations.removePropTypes This customization is used to remove `prop-types` declarations from React components. - **enable** (boolean): Determines whether the removal of `prop-types` is enabled (`true`) or not (`false`). - **options** (object): Contains settings related to `prop-types` removal. - **mode** ('remove'): Specifies the removal mode. Currently, only `'remove'` mode is supported. - **removeImport** (boolean): Determines whether the import statement for `prop-types` should also be removed when `prop-types` declarations are removed. ### babelCustomizations.devConsoleExclude This customization is used to exclude certain types of console messages from the build output in development mode. - **enable** (boolean or object): If a boolean, determines whether console message exclusion is enabled (`true`) or not (`false`). If an object, it can have two properties: - **value** (boolean): Determines whether the exclusion is enabled (`true`) or not (`false`). - **cli** (string): Provides an option to control the behavior through the CLI by using the specified command line argument. - **options** (object): Contains settings related to console message exclusion. - **exclude** (string array): Specifies the types of console messages that should be excluded from the build output. For example, `['error', 'warn']` would exclude both error and warning messages. ### babelCustomizations.plugins > Type: (array) This customization allows you to specify an array of Babel plugins that will be applied during transpilation. - **plugins** (array): An array of Babel plugins that will be used for transpilation. By customizing the `babelCustomizations` configuration, you can tailor the Babel transpilation process to meet the specific requirements of your project, such as removing certain attributes, optimizing for development console messages, or adding custom Babel plugins.