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

zlib_bindings problem when used in Vite with Typescript #1281

Open
Dylan190774 opened this issue Feb 29, 2024 · 0 comments · May be fixed by #1285
Open

zlib_bindings problem when used in Vite with Typescript #1281

Dylan190774 opened this issue Feb 29, 2024 · 0 comments · May be fixed by #1285

Comments

@Dylan190774
Copy link

Dylan190774 commented Feb 29, 2024

Expected Behavior

I expect no error messages when running the application

Current Behavior

The application build goes well, but when the application starts I get the following error:

[vite] error while updating dependencies:
Error: Build failed with 1 error:
node_modules/zlib/lib/zlib.js:1:25: ERROR: Could not resolve "./zlib_bindings"
    at failureErrorWithLog (C:\xampp\htdocs\testproject\node_modules\vite\node_modules\esbuild\lib\main.js:1651:15)
    at C:\xampp\htdocs\testproject\node_modules\vite\node_modules\esbuild\lib\main.js:1059:25
    at C:\xampp\htdocs\testproject\node_modules\vite\node_modules\esbuild\lib\main.js:1527:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Steps to Reproduce

I use Vite as builder (default in Quasar Framework).
In a Typescript file I use:

import Jimp from 'jimp';

///

Jimp.read(imagefile)
  .then((image) => {
    console.log(image);
});


I deleted entire node_modules folder and yarn.lock file and ran 'yarn' again.
Doesn't resolve the issue.

As a workaround I now use:

import 'jimp/browser/lib/jimp.js';

With that the application runs ok, but Visual Studio Code then gives 2 Eslint warnings:

  • Cannot find name 'Jimp'
  • Parameter 'image' implicitly has an 'any' type

I don't know what kind of object 'image' should be. (I'm learning Typescript, and have some trouble understanding which types there are in a library like yours).

Context

  • Jimp Version: latest version (in package.json it says '^0.22.12')
  • Operating System: Windows 10
  • Node version: v20.11.1

Failure Logs

@hipstersmoothie hipstersmoothie linked a pull request Mar 28, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant