cloudinary_npm icon indicating copy to clipboard operation
cloudinary_npm copied to clipboard

ESlint complains that v2 doesn't exist

Open kostas-pblworks opened this issue 1 year ago • 4 comments

Bug report for Cloudinary NPM SDK

Before proceeding, please update to latest version and test if the issue persists

Describe the bug in a sentence or two.

image

Issue Type (Can be multiple)

[ ] Build - Can’t install or import the SDK [ ] Babel - Babel errors or cross browser issues [ ] Performance - Performance issues [ ] Behaviour - Functions aren’t working as expected (Such as generate URL) [ ] Documentation - Inconsistency between the docs and behaviour [x] Incorrect Types - For typescript users who are having problems with our d.ts files [ ] Other (Specify)

Steps to reproduce

Enable the import/named rule of ESLint.

https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/named.md

Error screenshots

… if applicable

Browsers (if issue relates to UI, else ignore)

[ ] Chrome [ ] Firefox [ ] Safari [ ] Other (Specify) [ ] All

Versions and Libraries (fill in the version numbers)

Cloudinary_NPM SDK version 2.4.0 Node - 18.9.0 NPM - 10.2.3

Config Files (Please paste the following files if possible)

Package.json

Repository

If possible, please provide a link to a reproducible repository that showcases the problem

kostas-pblworks avatar Aug 26 '24 07:08 kostas-pblworks

Hi there,

Can you try initializing Cloudinary with the following:

const cloudinary = require('cloudinary').v2;

PixelCook avatar Aug 26 '24 11:08 PixelCook

@PixelCook I could but the whole point is to not use CommonJS and rather switch to ES6 modules. We are using TypeScript so we are able to do so.

The library could probably export an ES6 modules alongside the CommonJS interface.

Thank you!

kostas-pblworks avatar Aug 26 '24 11:08 kostas-pblworks

@kostas-pblworks have you tried the following?

import {v2 as cloudinary} from 'cloudinary'

PixelCook avatar Aug 26 '24 12:08 PixelCook

@PixelCook image

kostas-pblworks avatar Aug 26 '24 14:08 kostas-pblworks

Hi @kostas-pblworks. In order to speed up diagnosis, could you please create a simple repo which shows this issue so that we can debug this further?

dannyv-cloudinary avatar Aug 29 '24 09:08 dannyv-cloudinary