From 0405edee7d1696a157acab941488f8d3a750187f Mon Sep 17 00:00:00 2001 From: metonym Date: Thu, 7 Mar 2024 20:35:08 -0800 Subject: [PATCH] fix(exports): resolve imports with explicit *.js extension (#1927) Fixes #1925 Importing using the explicit `.*js` extension will throw an error as these are not included in the package exports map. Normally, this would be acceptable if it's not part of the API. However, the `optimizeImports` Carbon preprocessor rewrites certain imports (e.g., `breakpoints`) to the source `*.js` file. ```sh Internal server error: Failed to resolve import "carbon-components-svelte/src/Breakpoint/breakpoints.js" from "src/App.svelte". ``` --- package.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package.json b/package.json index f6f58896..12d9aad5 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,10 @@ "types": "./types/*.svelte.d.ts", "import": "./src/*.svelte" }, + "./src/*.js": { + "types": "./types/*.d.ts", + "import": "./src/*.js" + }, "./src/*": { "types": "./types/*.d.ts", "import": "./src/*.js"