From cfb35984105fb37c23f5e0c425c99543f8428516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 22 Sep 2022 14:09:19 +0200 Subject: [PATCH] no longer transpile tsx files in backend packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/swift-phones-cheat.md | 12 ++++++++++++ packages/cli/src/lib/bundler/config.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/swift-phones-cheat.md diff --git a/.changeset/swift-phones-cheat.md b/.changeset/swift-phones-cheat.md new file mode 100644 index 0000000000..97697ad916 --- /dev/null +++ b/.changeset/swift-phones-cheat.md @@ -0,0 +1,12 @@ +--- +'@backstage/cli': minor +--- + +Removed `tsx` and `jsx` as supported extensions in backend packages. For most +repos, this will not have any effect. But if you inadvertently had added some +`tsx`/`jsx` files to your backend package, you may now start to see `code: 'MODULE_NOT_FOUND'` errors when launching the backend locally. The reason for +this is that the offending files get ignored during transpilation. Hence, the +importing file can no longer find anything to import. + +The fix is to rename any `.tsx` files in your backend packages to `.ts` instead, +or `.jsx` to `.js`. diff --git a/packages/cli/src/lib/bundler/config.ts b/packages/cli/src/lib/bundler/config.ts index 0d4649fa3f..1974153f02 100644 --- a/packages/cli/src/lib/bundler/config.ts +++ b/packages/cli/src/lib/bundler/config.ts @@ -267,7 +267,7 @@ export async function createBackendConfig( paths.targetRunFile ? paths.targetRunFile : paths.targetEntry, ], resolve: { - extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'], + extensions: ['.ts', '.mjs', '.js', '.json'], mainFields: ['main'], modules: [paths.rootNodeModules, ...moduleDirs], plugins: [