anonrig / nestjs-keycloak-admin

Keycloak client and admin provider for Nest.js applications with built-in User Managed Access (UMA) and ACL support.
https://npmjs.com/package/nestjs-keycloak-admin
MIT License
181 stars 25 forks source link

Cannot use import statement outside a module import { KeycloakModule } from './module' #169

Closed mathmartins2 closed 1 year ago

mathmartins2 commented 1 year ago

im having SyntaxError: Cannot use import statement outside a module import { KeycloakModule } from './module'; even after adding "type": "module" in my package.json

using the "nestjs-keycloak-admin": "^2.0.0" version

here is my tsconfig

{
  "compilerOptions": {
    "module": "node16",
    "declaration": true,
    "removeComments": true,
    "noEmitOnError": true,
    "moduleDetection": "force",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "target": "ES2020",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "resolveJsonModule": false,
    "moduleResolution": "node16",
    "skipLibCheck": true,
    "strict": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": false,
    "noImplicitAny": true,
    "strictBindCallApply": false,
    "forceConsistentCasingInFileNames": false,
    "noFallthroughCasesInSwitch": false,
    "useUnknownInCatchVariables": true,
    "esModuleInterop": true,
    "allowJs": true,
    "paths": {
      "@application/*":["./src/application/*"],
      "@helpers/*":["./src/helpers/*"],
      "@infra/*":["./src/infra/*"],
      "@test/*":["./test/*"]
    },
  },
}
anonrig commented 1 year ago

Here's the guide to converting a typescript project to output ESM. You're missing couple of steps.

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm

revolist commented 1 year ago

We are using nestjs project on our side and it's not easy to convert to esm. Ended up making a fork for commonjs support.

dinbtechit commented 1 year ago

Here's the guide to converting a typescript project to output ESM. You're missing couple of steps.

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-make-my-typescript-project-output-esm

is there a step by step instructions for updating a NestJS project? The above documentation is extremely cumbersome to understand what is required and what doesn't for a nestjs project. Thanks in advance.!