From 9557e6e6c9ed5498b48b7bf89af8303b51c37787 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Tue, 20 Dec 2022 22:34:03 -0500 Subject: [PATCH] Update babel.config.js so build artifacts are compiled to ES5. dts-cli will utilize the babel.config.js file on build. The `targets` option for the @babel/preset-env plugin will determine what features the compiled output will target. Per babel docs: > When no targets are specified: Babel will assume you are targeting the oldest browsers possible. For example, @babel/preset-env will transform all ES2015-ES2020 code to be ES5 compatible. This approach will allow us to continue to write ESNext code while we can be confident RJSF users will still consume ES5 code. --- CHANGELOG.md | 1 + babel.config.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4812d51571..ec94d78d31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ should change the heading of the (upcoming) version to include a major version b # @rjsf/core - Pass the `schema` along to the `ArrayFieldItemTemplate` as part of the fix for [#3253](https://github.com/rjsf-team/react-jsonschema-form/issues/3253) +- Tweak Babel configuration to emit ES5-compatible output files, fixing [#3240](https://github.com/rjsf-team/react-jsonschema-form/issues/3240) # @rjsf/utils - Update the `ArrayFieldItemTemplate` to add `schema` as part of the fix for [#3253](https://github.com/rjsf-team/react-jsonschema-form/issues/3253) diff --git a/babel.config.js b/babel.config.js index d05bbc8a1c..614641eefd 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,7 +1,7 @@ const BABEL_ENV = process.env.BABEL_ENV; const IS_TEST = BABEL_ENV === "test" const ignore = IS_TEST ? [] : ['test/**/*.js'] -const targets = IS_TEST ? { node: "current" } : { browsers: "defaults" } +const targets = IS_TEST ? { node: "current" } : {} module.exports = { presets: [