huozhi / bunchee

Zero config bundler for ECMAScript and TypeScript packages
https://npmjs.com/bunchee
945 stars 29 forks source link

subpath import fallback for `edge-light`, `workerd`... is empty #589

Closed himself65 closed 1 month ago

himself65 commented 1 month ago

See https://github.com/himself65/bunchee-issue-589

a output is wrong https://github.com/himself65/bunchee-issue-589/blob/main/dist/a.edge-light.js

himself65 commented 1 month ago

workaround

Index: package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/package.json b/package.json
--- a/package.json  (revision dee56ab293d17a2816386a369db175d43f18a1d0)
+++ b/package.json  (date 1730074877168)
@@ -11,6 +11,7 @@
       "edge-light": "./dist/a.edge-light.js"
     },
     "./b": {
+      "edge-light": "./dist/b.edge-light.js",
       "default": "./dist/b.js"
     }
   },
himself65 commented 1 month ago
sourceToRelativeBundleMap Map(1) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js ./dist/a.edge-light.js
sourceToRelativeBundleMap Map(1) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/b.js undefined
sourceToRelativeBundleMap Map(0) {} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js undefined
sourceToRelativeBundleMap Map(1) {
Exports           File                  Size
./a (edge-light)  dist/a.edge-light.js  18 B
./b               dist/b.js             26 B

sourceToRelativeBundleMap Map(1) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js ./dist/a.edge-light.js
sourceToRelativeBundleMap Map(2) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js',
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/b.js' => './dist/b.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/b.js ./dist/b.edge-light.js
sourceToRelativeBundleMap Map(1) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js ./dist/a.edge-light.js
sourceToRelativeBundleMap Map(2) {
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js' => './dist/a.edge-light.js',
  '/Users/himself65/Code/bunchee/test/integration/import-fallback/src/b.js' => './dist/b.edge-light.js'
} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/b.js ./dist/b.edge-light.js
sourceToRelativeBundleMap Map(0) {} /Users/himself65/Code/bunchee/test/integration/import-fallback/src/a/index.edge-light.js undefined
sourceToRelativeBundleMap Map(1) {
Exports           File                  Size
./a (edge-light)  dist/a.edge-light.js  28 B
./b               dist/b.edge-light.js  26 B
                  dist/b.js             26 B