molivera
molivera

Reputation: 1

Compiling Angular 12.2.17 code as a library, get the following error Error: No supported format property to consider among [tsconfig-aot.json]

I'm having the following error:

Error: No supported format property to consider among [tsconfig-aot.json]. Supported properties: fesm2015, fesm5, es2015, esm2015, esm5, main, module, browser

I am currently creating custom libraries to use in my Angular projects, using the Gulp tool to compile the code.

The error occurs when I run the following command

gulp.task('ngcc-compile', async function () {
    exec('"./node_modules/.bin/ngcc" -p tsconfig-aot.json', function (err, stdout, stderr) {
        console.log(stdout);
        console.log(stderr);
    });
});

The content of my tsconfig-aot.json file is:

{
  "compilerOptions": {
    "target": "es2015",
    "module": "CommonJS",
    "moduleResolution": "node",
    "sourceMap": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": true,
    "noImplicitAny": false,
    "declaration": true,
    "suppressImplicitAnyIndexErrors": true,
    "outDir": "./dist",
    "typeRoots": [
      "./node_modules/@types"
    ],
    "lib": [
      "es2017",
      "dom"
    ]
  },
  "exclude": [
    "node_modules",
    "demo",
    "dist",
    "doc"
  ],
  "angularCompilerOptions": {
    "enableIvy": true
  }
}

I set the value of enableIvy to true because I'm using Angular 12.2.17 for the library dependencies, and from what I've been reading it's necessary to use enableIvy to true, correct me if I'm wrong.

If necessary, I can add more information related to the project to help solve the problem.

The version of node I have is: 14.21.3

The version of Angular CLI I have is: 12.2.18

The version of NPM I have is: 7.24.2

I've already tried modifying the "target", "module" values ​​and the values ​​inside "libs[ ]", but I still get the same error.

Also, I tried using this script in the package.json file, but it still gives the same error

  "scripts": {
    "postinstall": "npx --package @angular/[email protected] --yes ngcc"
  },

Upvotes: 0

Views: 39

Answers (0)

Related Questions