Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using esbuild instead of Rollup fixes known terser bug #39

Open
zauni opened this issue Apr 12, 2022 · 2 comments
Open

Using esbuild instead of Rollup fixes known terser bug #39

zauni opened this issue Apr 12, 2022 · 2 comments

Comments

@zauni
Copy link
Contributor

zauni commented Apr 12, 2022

Hello @puzrin, locally I tried to build this library with esbuild instead of Rollup and this fixed the known issue with terser. Would you be interested in a PR to change the build from Rollup to esbuild?

Locally I built the ESM version with esbuild by issuing this command:
npx esbuild index.js --bundle --format=esm --outfile=dist/image-blob-reduce.esm.mjs and by using npm link I could try it out on a local project which is suffering from the terser bug, but as said with the esbuild version this bug did not appear.

The only problem with changing bundlers is that there could be other subtle problems coming up, but in my limited testing with the ESM version it was working just fine. But maybe you have more projects (best would be CJS projects) to test some new bundled versions.

Update: I saw that esbuild does not generate UMD bundles, so maybe these should be generated by Rollup like before. And just the ESM bundle which is also exported by the package.json will be generated by esbuild.

@non25
Copy link

non25 commented Mar 31, 2023

I've found that forcing source version by using patch-package yields good results without any effort. 🙂
nodeca/pica#228 (comment)

@nktka
Copy link

nktka commented May 8, 2023

Importing minified version in CRA fixes the issue.

I went from:

import p from 'image-blob-reduce';
const pica = p();

to:

import type { ImageBlobReduceStatic } from 'image-blob-reduce';
// @ts-ignore
import p from 'image-blob-reduce/dist/image-blob-reduce.min.js';
const pica = (p as ImageBlobReduceStatic)();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants