okikio / bundlejs

An online tool to quickly bundle & minify your projects, while viewing the compressed gzip/brotli bundle size, all running locally on your browser.
https://bundlejs.com
MIT License
751 stars 13 forks source link

Build failed for `recharts@2.8.0` #61

Closed remnantkevin closed 2 months ago

remnantkevin commented 11 months ago

Code editor contents

// Click Build for the Bundled, Minified & Compressed package size
export * from "recharts@2.8.0";
export { default } from "recharts@2.8.0";

URL

https://bundlejs.com/?q=recharts%402.8.0

Browser console errors

index.ts:134 ✘ [ERROR] Do not know how to load path: http-url:https://unpkg.com/dom-helpers@5.2.1/class/addClass

    http-url:https://unpkg.com/react-transition-group@2.9.0/CSSTransition:8:47:
      8 │ ...ss = _interopRequireDefault(require("dom-helpers/class/addClass"));
        ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

st @ index.ts:134
(anonymous) @ index.ts:267
error @ index.ts:266
(anonymous) @ api.es.js:1
forEach @ api.es.js:1
(anonymous) @ api.es.js:1
emit @ api.es.js:1
(anonymous) @ index.ts:91

✘ [ERROR] Do not know how to load path: http-url:https://unpkg.com/dom-helpers@5.2.1/class/removeClass

    http-url:https://unpkg.com/react-transition-group@2.9.0/CSSTransition:10:50:
      10 │ ... _interopRequireDefault(require("dom-helpers/class/removeClass"));
         ╵                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

st @ index.ts:134
(anonymous) @ index.ts:267
error @ index.ts:266
(anonymous) @ api.es.js:1
forEach @ api.es.js:1
(anonymous) @ api.es.js:1
emit @ api.es.js:1
(anonymous) @ index.ts:91

Browser details

Chome
Version 117.0.5938.132 (Official Build) (arm64)

Screenshot of errors on webpage

Click to see screenshot

![bundlejs-error-recharts](https://github.com/okikio/bundlejs/assets/8270635/970f9151-465a-4711-b729-c10cb2048bb8)

nickpresta commented 6 months ago

Seeing the same sort of thing with a different package (link):

// @protobuf-ts
import { RpcError, stackIntercept, ServiceType } from "@protobuf-ts/runtime-rpc";
import { isJsonObject, typeofJsonValue, PbLong, ScalarType, LongType, MessageType } from "@protobuf-ts/runtime";
import { TwirpFetchTransport } from "@protobuf-ts/twirp-transport";

console.log(RpcError, stackIntercept, ServiceType, isJsonObject, typeofJsonValue, PbLong, ScalarType, LongType, MessageType, TwirpFetchTransport);

I get:

✘ [ERROR] Do not know how to load path: http-url:https://unpkg.com/@protobuf-ts/twirp-transport@2.9.3

/input.ts:4:36:

      4 │ import { TwirpFetchTransport } from "@protobuf-ts/twirp-transport";
        ╵                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For what it's worth, switching CDNs might work around issues with specific package.

For example, swapping to skypack as the CDN using the skypack: protocol before the package name (e.g. import thing from 'skypack:package') still breaks with the same sort of error message, but switching to esm.run:package works fine for the example above

okikio commented 6 months ago

I was able to get the RPC bundle working

SmartSelect_20240306-134926_Kiwi Browser.jpg

But yeah there is actually a problem with the original bundle it's using the wrong version of the package

Screenshot_20240306-140718_Kiwi Browser.jpg

SmartSelect_20240306-140826_Kiwi Browser.jpg

SmartSelect_20240306-140844_Kiwi Browser.jpg

SmartSelect_20240306-141237_Kiwi Browser.jpg

okikio commented 2 months ago

This issue is now fixed 💯