'GitHub Actions: Issue with ESM and node 12

Team, I'm working on a node.js project and after bundling with ncc (ncc build index.js --license licenses.txt) I have errors with imports using the node: protocol:

    import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "module";
    ^^^^^^
    
    SyntaxError: Cannot use import statement outside a module
        at Module._compile (internal/modules/cjs/loader.js:895:18)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
        at Module.load (internal/modules/cjs/loader.js:815:32)
        at Function.Module._load (internal/modules/cjs/loader.js:727:14)
        at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
        at internal/main/run_main_module.js:17:11

Did I miss something or it an issue with the ncc?

package.json

    {
      "private": true,
      "name": "validate-github-action",
      "version": "2.0.0",
      "description": "See CONTRIBUTING.md for how to contribute to this project",
      "main": "dist/index.js",
      "type": "module",
      "scripts": {
        "build": "ncc build index.js --license licenses.txt"
      },
      "bugs": {
        "url": "xxxxxxx"
      },
      "homepage": "xxxxxxxxxx",
      "dependencies": {
        "@actions/core": "^1.6.0",
        "ajv": "^8.9.0",
        "ansi-styles": "^6.1.0",
        "awesome-ajv-errors": "4.1.2",
        "ionic": "^5.4.16",
        "parse-json": "^6.0.2"
      },
      "devDependencies": {
        "@babel/cli": "^7.17.6",
        "@babel/core": "^7.17.8",
        "@babel/preset-env": "^7.16.11",
        "@types/node": "^12.12.31",
        "@vercel/ncc": "^0.33.1"
      }
    }

jsconfig.json:

    {
      "compilerOptions": {
        "module": "esnext",
        "target": "es2017",
        "moduleResolution": "node"
      }
    }

Failed GitHub Workflow Job Screenshot



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source