image-size / image-size

Node module for detecting image dimensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error reported during compilation

dengxueru opened this issue · comments

commented

version 1.1.1
image

1.1.1 is still a node.js-only release, and no bundlers are supported.
But, 2.0 plans to address this.

can you please install image-size@beta, and try again?

commented

1.1.1 is still a node.js-only release, and no bundlers are supported. But, 2.0 plans to address this.

can you please install image-size@beta, and try again?

  1. I used image-size@beta, which did not solve this problem.
  2. It should be a compilation problem
    error in ./node_modules/image-size/dist/esm/lookup.mjs
    I saw that the error message was size.type = size.type ?? type. Is this new syntax not supported??
  3. I cannot use babel to adapt to the advanced syntax in node_modules

Ah, The error with ?? sounds like that your setup doesn't support Nullish coalescing operator, which has been supported on most tooling for a few years now.

Would it be possible to create a test setup reproducing this issue? Then I could provide recommendations around how to fix this.

@dengxueru is there any more information you can share about your build tooling? without that it's difficult to support you.

Since, we can't expect npm package maintainers to not new (but stable) language features, the solution here would be to try to fix the tooling instead.

If that's not an option, I'd recommend downgrading to 1.0.2 instead.
If a someday a security issue is discovered in 1.0.2, I'll try my best to release 1.0.3.

@dengxueru is there any more information you can share about your build tooling? without that it's difficult to support you.

Since, we can't expect npm package maintainers to not new (but stable) language features, the solution here would be to try to fix the tooling instead.

If that's not an option, I'd recommend downgrading to 1.0.2 instead. If a someday a security issue is discovered in 1.0.2, I'll try my best to release 1.0.3.

I experience the same error, v1.1.1 with the "??" worked fine while compiling with Node v18.17.0 on windows, but did not when deploying my Node.js Express Web App to Linux on Azure built with Node - 10.10

Downgrading to 1.0.2 has resolved the compile error for my app.

I don't really want to provide support for decommissioned versions of nodejs. Nodejs 10.10 is almost 6 years old.

But just in case this is somehow business critical, please let me know. Fixing this is not a big deal.

However I prefer to keep this issue open as a reminder that all actively maintained systems should update their entire stack, not just their node_modules. Older versions of nodejs (or any runtime) are likely to be a security nightmare.

@netroy You are absolutely right... being new to Azure, my initial assumption when deploying my app was that azure would select the latest stable version of Node when creating an initial web app project.. I am seeing that after updating Node to 20-LTS I am able to use v1.1.1 of image-size.