From 740f20927ef8c061e428f5b33e304f398bee1c3e Mon Sep 17 00:00:00 2001 From: Patrick Taylor Date: Sat, 8 Jun 2024 14:05:03 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Convert=20babel=20config=20from=20JSON=20to?= =?UTF-8?q?=20JavaScript=20=E2=98=95=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- babel.config.js | 19 +++++++++++++++++++ babel.config.json | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 babel.config.js delete mode 100644 babel.config.json diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..6abffee --- /dev/null +++ b/babel.config.js @@ -0,0 +1,19 @@ +module.exports = { + presets: [ + ["@babel/preset-env", { targets: { node: "current" } }], + ], + env: { + cjs: { + presets: [["@babel/preset-env", { modules: "commonjs" }]], + plugins: [ + ["babel-plugin-add-import-extension", { extension: "cjs" }], + ], + }, + esm: { + presets: [["@babel/preset-env", { modules: false }]], + plugins: [ + ["babel-plugin-add-import-extension", { extension: "js" }], + ], + }, + }, +} diff --git a/babel.config.json b/babel.config.json deleted file mode 100644 index 1c726c9..0000000 --- a/babel.config.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "presets": [ - ["@babel/preset-env", { "targets": { "node": "current" } }] - ], - "env": { - "cjs": { - "presets": [["@babel/preset-env", { "modules": "commonjs" }]], - "plugins": [ - ["babel-plugin-add-import-extension", { "extension": "cjs" }] - ] - }, - "esm": { - "presets": [["@babel/preset-env", { "modules": false }]], - "plugins": [ - ["babel-plugin-add-import-extension", { "extension": "js" }] - ] - } - } -} From 9fdfbc5ecdd88cf2341dde79dfbec1c22d43a8f9 Mon Sep 17 00:00:00 2001 From: Patrick Taylor Date: Sat, 8 Jun 2024 14:20:08 +0100 Subject: [PATCH 2/3] =?UTF-8?q?Update=20moduleNameMapper=20to=20support=20?= =?UTF-8?q?multiple=20files=20=F0=9F=97=BA=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jest/cjs.config.js | 3 +-- jest/esm.config.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/jest/cjs.config.js b/jest/cjs.config.js index e8bd7aa..4a940f3 100644 --- a/jest/cjs.config.js +++ b/jest/cjs.config.js @@ -3,8 +3,7 @@ import baseConfig from '../jest.config.js' export default { ...baseConfig, moduleNameMapper: { - '/src/config$': '/lib/config.cjs', - '/src/index$': '/lib/index.cjs', + '/src/(.*)$': '/lib/$1.cjs', }, rootDir: '../', } diff --git a/jest/esm.config.js b/jest/esm.config.js index b8e4a59..2e4ba60 100644 --- a/jest/esm.config.js +++ b/jest/esm.config.js @@ -3,8 +3,7 @@ import baseConfig from '../jest.config.js' export default { ...baseConfig, moduleNameMapper: { - '/src/config$': '/lib/config.js', - '/src/index$': '/lib/index.js', + '/src/(.*)$': '/lib/$1.js', }, rootDir: '../', } From 101dbab412a22a565c7c0960fdada6546f1ccd95 Mon Sep 17 00:00:00 2001 From: Patrick Taylor Date: Sat, 8 Jun 2024 14:32:06 +0100 Subject: [PATCH 3/3] =?UTF-8?q?Change=20babel=20config=20extension=20to=20?= =?UTF-8?q?cjs=20=F0=9F=9B=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- babel.config.js => babel.config.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename babel.config.js => babel.config.cjs (100%) diff --git a/babel.config.js b/babel.config.cjs similarity index 100% rename from babel.config.js rename to babel.config.cjs