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

Support for ES6 imports #350

Open
rohanrajpal opened this issue May 14, 2023 · 6 comments
Open

Support for ES6 imports #350

rohanrajpal opened this issue May 14, 2023 · 6 comments
Assignees

Comments

@rohanrajpal
Copy link

Steps to reproduce the behavior

  1. Bootstap a Nestjs app
  2. Import Razorpay via import Razorpay from 'razorpay';
  3. Try to instantiate Razorpay using new Razorpay()

Expected behavior

Razorpay instance is created & we can use it

Actual behavior

[Nest] 76015  - 05/14/2023, 5:32:25 PM   ERROR [ExceptionHandler] razorpay_1.default is not a constructor
TypeError: razorpay_1.default is not a constructor
    at new SubscriptionService (/Users/rohanrajpal/Documents/spur/code/spur/apps/api/src/subscription/subscription.service.ts:13:28)
    at Injector.instantiateClass (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/injector.js:351:19)
    at callback (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/injector.js:56:45)
    at Injector.resolveConstructorParams (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/injector.js:136:24)
    at Injector.loadInstance (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/injector.js:61:13)
    at Injector.loadProvider (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/injector.js:88:9)
    at /Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/instance-loader.js:56:13
    at async Promise.all (index 3)
    at InstanceLoader.createInstancesOfProviders (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/instance-loader.js:55:9)
    at /Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/instance-loader.js:40:13
    at async Promise.all (index 42)
    at InstanceLoader.createInstances (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/instance-loader.js:39:9)
    at InstanceLoader.createInstancesOfDependencies (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/injector/instance-loader.js:22:13)
    at /Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/nest-factory.js:108:17
    at Function.asyncRun (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/errors/exceptions-zone.js:22:13)
    at NestFactoryStatic.initialize (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/nest-factory.js:106:13)
    at NestFactoryStatic.create (/Users/rohanrajpal/Documents/spur/code/spur/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_xuvxxxp3szkdb54hldj3vibemy/node_modules/@nestjs/core/nest-factory.js:42:9)
    at bootstrap (/Users/rohanrajpal/Documents/spur/code/spur/apps/api/src/main.ts:19:17)

Code snippets

No response

Node version

Node 18.16.0

Library version

razorpay-node 2.8.6

Additional Information

No response

@rohanrajpal
Copy link
Author

Temp solutoin, enable esModuleInterop

{
    "compilerOptions": {
        "module": "commonjs",
        "resolveJsonModule": true,
        "removeComments": true,
        "esModuleInterop": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "allowSyntheticDefaultImports": true,
        "target": "es2017",
        "sourceMap": true,
        "outDir": "./dist",
        "baseUrl": "./src",
        "incremental": true,
        "skipLibCheck": true,
        "strictNullChecks": true,
        "noImplicitAny": false,
        "strictBindCallApply": false,
        "forceConsistentCasingInFileNames": false,
        "noFallthroughCasesInSwitch": false,
        "paths": {
            "@/*": ["./*"]
        }
    }
}

@ankitdas13
Copy link
Contributor

@rohanrajpal ES6 feature is in development and when we have a PR ready, we will let you know

@rohanrajpal
Copy link
Author

@rohanrajpal ES6 feature is in development and when we have a PR ready, we will let you know

thanks, looking forward!

@myacademia-zone
Copy link

Still not developed?

@rohanrajpal
Copy link
Author

I guess not :(

@jaiakash
Copy link

jaiakash commented Jan 10, 2024

Is it still not ready? If not, i would like to help.

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

No branches or pull requests

4 participants