2. Upgrade Module System

Update module system

The "update module system" patch moves your application from CommonJS to ESM.

npx @adonisjs/upgrade-kit@latest upgrade-module-system

Following are the steps performed by this patch.

  • Define type = module inside the package.json file.

  • Make tsconfig.json file extend the new base config from @adonisjs/tsconfig package.

  • Remove unnecessary known types from the compilerOptions.types array.

    {
    "compilerOptions": {
    "types": [
    "@adonisjs/core",
    "@adonisjs/repl",
    "@adonisjs/session",
    "@adonisjs/view",
    "@adonisjs/shield",
    "@adonisjs/lucid",
    "@adonisjs/auth",
    "@adonisjs/lucid-slugify",
    "@adonisjs/drive-s3",
    "@adonisjs/attachment-lite",
    "@japa/preset-adonis/build/adonis-typings"
    ]
    }
    }