| // Copyright 2026 The Chromium Authors | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| export async function resolve(specifier, context, nextResolve) { | |
| try { | |
| return await nextResolve(specifier, context); | |
| } catch (err) { | |
| if (specifier.endsWith('.js')) { | |
| const tsSpecifier = specifier.slice(0, -3) + '.ts'; | |
| try { | |
| return await nextResolve(tsSpecifier, context); | |
| } catch { | |
| // Fall back to original error | |
| } | |
| } | |
| throw err; | |
| } | |
| } |