diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 356c6ac..0000000 --- a/.babelrc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "presets": ["react-app"], - "plugins": [ - "@babel/plugin-syntax-class-properties", - "@babel/plugin-syntax-jsx", - "react-html-attrs" - ], - "env": { - "test": { - "plugins": [ - "istanbul" - ] - } - } -} \ No newline at end of file diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..cfe82a4 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,11 @@ +module.exports = api => { + const isTest = api.env('test') + + return { + presets: [ + ['@babel/preset-env', { modules: isTest ? 'commonjs' : false }], + ['@babel/preset-react', { runtime: 'classic' }] + ], + plugins: ['react-html-attrs', isTest && 'istanbul'].filter(Boolean) + } +} diff --git a/package.json b/package.json index a179062..f70897c 100644 --- a/package.json +++ b/package.json @@ -285,18 +285,16 @@ "react-textarea-autosize": "~8.5.9" }, "devDependencies": { - "@babel/core": "^7.13.0", - "@babel/eslint-parser": "~7.29.7", - "@babel/plugin-proposal-private-property-in-object": "~7.21.11", - "@babel/plugin-syntax-class-properties": "~7.12.1", - "@babel/plugin-syntax-jsx": "~7.29.7", - "@babel/register": "7.29.7", + "@babel/core": "~8.0.5", + "@babel/eslint-parser": "~8.0.5", + "@babel/preset-env": "~8.0.5", + "@babel/preset-react": "~8.0.1", + "@babel/register": "~8.0.5", "@commitlint/cli": "latest", "@commitlint/config-conventional": "latest", "babel-loader": "10.1.1", "babel-plugin-istanbul": "8.0.0", "babel-plugin-react-html-attrs": "~3.0.5", - "babel-preset-react-app": "10.1.0", "browser-sync": "~3.0.3", "c8": "latest", "chai": "~6.2.2",