From ebca1063a46efb8fe1446ad858ebfbcc39c5e12b Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Fri, 3 Jul 2026 14:41:24 +0100 Subject: [PATCH] fix: add explicit extensions to web-features Importing `web-features` in a project which uses node16 resolution currently fails since it can't resolve `"./types"`. This means the types we get are basically `Record` rather than `Record`. Given that this package requires a node-like runtime (it imports `node:fs`), I think it makes sense to set the `module` to `node18` and the `moduleResolution` to `node16`. This should basically enforce things like file extensions, respecting export maps, etc. --- packages/web-features/index.ts | 2 +- packages/web-features/tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/web-features/index.ts b/packages/web-features/index.ts index 54ae8ee16c0..8196ca6ceba 100644 --- a/packages/web-features/index.ts +++ b/packages/web-features/index.ts @@ -1,7 +1,7 @@ import { readFileSync } from "node:fs"; import { fileURLToPath } from "node:url"; -import { WebFeaturesData } from "./types"; +import { WebFeaturesData } from "./types.js"; const jsonPath = fileURLToPath(new URL("./data.json", import.meta.url)); const { browsers, features, groups, snapshots } = JSON.parse( diff --git a/packages/web-features/tsconfig.json b/packages/web-features/tsconfig.json index 5b8a54dccaf..ce629192711 100644 --- a/packages/web-features/tsconfig.json +++ b/packages/web-features/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "ES2016", - "module": "ESNext", - "moduleResolution": "Bundler", + "module": "node18", + "moduleResolution": "node16", "typeRoots": ["./node_modules/@types"], "declaration": true, "types": ["node"]