From d306b099fd8af6de83c6df6e4037457795e34608 Mon Sep 17 00:00:00 2001 From: Josh GM Walker <56300765+Josh-Walker-GM@users.noreply.github.com> Date: Thu, 15 Aug 2024 03:56:36 +0100 Subject: [PATCH] enable and fix --- .eslintrc.js | 1 - .../src/plugins/babel-plugin-redwood-routes-auto-loader.ts | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 423923ee35b2..85ab16b924f1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -225,7 +225,6 @@ module.exports = { '@typescript-eslint/no-base-to-string': 'off', '@typescript-eslint/no-duplicate-type-constituents': 'off', '@typescript-eslint/unbound-method': 'off', - '@typescript-eslint/prefer-find': 'off', }, }, { diff --git a/packages/babel-config/src/plugins/babel-plugin-redwood-routes-auto-loader.ts b/packages/babel-config/src/plugins/babel-plugin-redwood-routes-auto-loader.ts index 6e60aa587d0c..7e51858f6d57 100644 --- a/packages/babel-config/src/plugins/babel-plugin-redwood-routes-auto-loader.ts +++ b/packages/babel-config/src/plugins/babel-plugin-redwood-routes-auto-loader.ts @@ -77,9 +77,12 @@ export default function ( importStatementPath(p.node.source?.value), ) - const defaultSpecifier = p.node.specifiers.filter((specifiers) => + const defaultSpecifier = p.node.specifiers.find((specifiers) => t.isImportDefaultSpecifier(specifiers), - )[0] + ) + if (!defaultSpecifier) { + return + } // Remove Page imports in prerender mode (see babel-preset) // The removed imports will be replaced further down in this file