polyfills.ts and main.ts missing from TypeScript compilation

Discussão em 'Angular' iniciado por Yuri Galiza, Agosto 18, 2025.

  1. Yuri Galiza

    Yuri Galiza Guest

    I've just migrated an application from Angular 17 to Angular 19, following their guides on everything. I've updated all necessary dependencies, fixed all SCSS files, fixed most configuration files that I've encountered issues, but there's one thing that I cannot fix whatsoever.

    All this configuration was already in there when I joined the company. People was very unexperienced with Angular (any version) and TypeScript, so there's a lot of bad practices and issues with configuration throughout the project.

    Here's the error that I get when either building (we use Vercel) or running locally.

    X [ERROR] File 'apps\<app1>\src\main.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

    Ensure the file is part of the TypeScript program via the 'files' or 'include' property.


    X [ERROR] File 'apps\<app1>\src\polyfills.ts' is missing from the TypeScript compilation. [plugin angular-compiler]

    angular:polyfills:angular:polyfills:2:7:
    2 │ import './apps/<app1>/src/polyfills.ts';
    ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Ensure the file is part of the TypeScript program via the 'files' or 'include' property.


    Here are all my relevant files.

    I'll list all relevant files that are contained in the same folder as apps/<app1>

    tsconfig.app.json

    {
    "extends": "./tsconfig.json",
    "compilerOptions": {
    "outDir": "../../dist/out-tsc",
    "types": ["node"]
    },
    "files": ["src/main.ts", "src/polyfills.ts"],
    "exclude": ["src/test.ts", "**/*.spec.ts", "jest.config.ts"],
    "include": ["**/*.ts", "../../libs/<lib1>/src/index.ts"]
    }


    <app1>/project.json

    {
    "$schema": "../../node_modules/nx/schemas/project-schema.json",
    "name": "<app1>",
    "sourceRoot": "apps/<app1>/src",
    "projectType": "application",
    "prefix": "ms",
    "generators": {
    "@schematics/angular:component": {
    "style": "scss"
    }
    },
    "targets": {
    "build": {
    "executor": "@angular-devkit/build-angular:browser",
    "options": {
    "preserveSymlinks": true,
    "outputPath": "dist/apps/<app1>",
    "index": "apps/<app1>/src/index.html",
    "browser": "apps/<app1>/src/main.ts",
    "polyfills": ["apps/<app1>/src/polyfills.ts"],
    "tsConfig": "apps/<app1>/tsconfig.app.json",
    "assets": [
    "apps/<app1>/src/favicon.ico",
    "apps/<app1>/src/assets",
    "apps/<app1>/src/env.js",
    "apps/<app1>/src/manifest.json"
    ],
    "styles": ["apps/<app1>/src/styles.scss"],
    "allowedCommonJsDependencies": [
    "@progress/kendo-angular-intl/locales/fr-BE/all",
    "@progress/kendo-angular-intl/locales/fr-BE/calendar",
    "@progress/kendo-angular-intl/locales/nl-BE/all",
    "@progress/kendo-angular-intl/locales/de-BE/all",
    "lodash",
    "big-integer",
    "@antoinepairet/iban-bic-belgium/bic-from-iban",
    "browser-xml2js",
    "encoding",
    "jsbarcode",
    "jschardet",
    "ngx-barcode6",
    "ngx-kjua",
    "evaljs",
    "p-limit",
    "pako",
    "pdfmake",
    "exponential-backoff"
    ]
    },
    "configurations": {
    "production": {
    "fileReplacements": [
    {
    "replace": "apps/<app1>/src/environments/environment.ts",
    "with": "apps/<app1>/src/environments/environment.prod.ts"
    },
    {
    "replace": "apps/<app1>/src/env.js",
    "with": "apps/<app1>/src/env_prod.js"
    }
    ],
    "outputHashing": "all",
    "sourceMap": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "serviceWorker": true
    },
    "development": {
    "aot": true,
    "optimization": false,
    "sourceMap": false,
    "namedChunks": false,
    "extractLicenses": false,
    "vendorChunk": true,
    "buildOptimizer": false,
    "budgets": [],
    "outputHashing": "none",
    "statsJson": false,
    "progress": true
    }
    },
    "outputs": ["{options.outputPath}"],
    "defaultConfiguration": "development"
    },
    "serve": {
    "executor": "@angular-devkit/build-angular:dev-server",
    "options": {
    "buildTarget": "<app1>:build",
    "historyApiFallback": true
    },
    "configurations": {
    "production": {
    "buildTarget": "<app1>:build:production"
    },
    "development": {
    "buildTarget": "<app1>:build:development"
    }
    },
    "defaultConfiguration": "development"
    },
    "extract-i18n": {
    "executor": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "buildTarget": "<app1>:build"
    }
    },
    "lint": {
    "executor": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": ["apps/<app1>/tsconfig.app.json", "apps/<app1>/tsconfig.spec.json"],
    "exclude": ["**/node_modules/**"]
    }
    },
    "test": {
    "executor": "@nx/jest:jest",
    "options": {
    "jestConfig": "apps/<app1>/jest.config.ts",
    "passWithNoTests": true
    },
    "outputs": ["coverage/apps/<app1>/"]
    }
    }
    }


    <app1>/tsconfig.json

    {
    "extends": "../../tsconfig.json",
    "compilerOptions": {
    "types": ["node", "jest"]
    },
    "include": [],
    "references": [
    {
    "path": "./tsconfig.app.json"
    },
    {
    "path": "./tsconfig.spec.json"
    },
    {
    "path": "./tsconfig.editor.json"
    }
    ]
    }


    Root files package.json

    "dependencies": {
    "@angular/animations": "19.2.14",
    "@angular/common": "19.2.14",
    "@angular/compiler": "19.2.14",
    "@angular/core": "19.2.14",
    "@angular/forms": "19.2.14",
    "@angular/localize": "19.2.14",
    "@angular/platform-browser": "19.2.14",
    "@angular/platform-browser-dynamic": "19.2.14",
    "@angular/router": "19.2.14",
    "@angular/service-worker": "19.2.14",
    "@antoinepairet/iban-bic-belgium": "^1.1.0",
    "@auth0/angular-jwt": "^2.0.0",
    "@auth0/auth0-angular": "^2.2.3",
    "@fullcalendar/angular": "^6.1.9",
    "@fullcalendar/bootstrap": "^6.1.9",
    "@fullcalendar/core": "^6.1.9",
    "@fullcalendar/interaction": "^6.1.9",
    "@fullcalendar/moment": "^6.1.9",
    "@fullcalendar/resource": "^6.1.9",
    "@fullcalendar/resource-daygrid": "^6.1.9",
    "@fullcalendar/resource-timegrid": "^6.1.9",
    "@icure/api": "8.4.8",
    "@icure/be-fhc-api": "0.6.5",
    "@icure/form": "2.0.10",
    "@icure/kerberus": "^1.1.4",
    "@ngneat/until-destroy": "^9.2.3",
    "@ngx-translate/core": "15.0.0",
    "@ngx-translate/http-loader": "8.0.0",
    "@ngxs/storage-plugin": "19.0.0",
    "@ngxs/store": "19.0.0",
    "@progress/kendo-angular-buttons": "^19.2.0",
    "@progress/kendo-angular-charts": "^19.2.0",
    "@progress/kendo-angular-common": "^19.2.0",
    "@progress/kendo-angular-dateinputs": "^19.2.0",
    "@progress/kendo-angular-dialog": "^19.2.0",
    "@progress/kendo-angular-dropdowns": "^19.2.0",
    "@progress/kendo-angular-excel-export": "^19.2.0",
    "@progress/kendo-angular-gauges": "^19.2.0",
    "@progress/kendo-angular-grid": "^19.2.0",
    "@progress/kendo-angular-icons": "^19.2.0",
    "@progress/kendo-angular-indicators": "^19.2.0",
    "@progress/kendo-angular-inputs": "^19.2.0",
    "@progress/kendo-angular-intl": "^19.2.0",
    "@progress/kendo-angular-l10n": "^19.2.0",
    "@progress/kendo-angular-label": "^19.2.0",
    "@progress/kendo-angular-layout": "^19.2.0",
    "@progress/kendo-angular-listview": "^19.2.0",
    "@progress/kendo-angular-menu": "^19.2.0",
    "@progress/kendo-angular-navigation": "^19.2.0",
    "@progress/kendo-angular-pager": "^19.2.0",
    "@progress/kendo-angular-pdf-export": "^19.2.0",
    "@progress/kendo-angular-pdfviewer": "^19.2.0",
    "@progress/kendo-angular-popup": "^19.2.0",
    "@progress/kendo-angular-progressbar": "^19.2.0",
    "@progress/kendo-angular-spreadsheet": "^19.2.0",
    "@progress/kendo-angular-toolbar": "^19.2.0",
    "@progress/kendo-angular-tooltip": "^19.2.0",
    "@progress/kendo-angular-treelist": "^19.2.0",
    "@progress/kendo-angular-treeview": "^19.2.0",
    "@progress/kendo-angular-upload": "^19.2.0",
    "@progress/kendo-angular-utils": "^19.2.0",
    "@progress/kendo-data-query": "^1.7.0",
    "@progress/kendo-drawing": "^1.20.1",
    "@progress/kendo-font-icons": "^4.5.0",
    "@progress/kendo-licensing": "^1.3.5",
    "@progress/kendo-svg-icons": "^4.5.0",
    "@progress/kendo-theme-default": "^11.3.2",
    "@sentry/angular": "^10.1.0",
    "@sentry/cli": "^2.50.2",
    "@tinymce/tinymce-angular": "8.0.1",
    "@types/dompurify": "^3.0.5",
    "@types/showdown": "2.0.6",
    "@waiting/base64": "^4.2.9",
    "@zxing/browser": "^0.1.5",
    "@zxing/library": "^0.21.3",
    "@zxing/ngx-scanner": "^19.0.0",
    "angular-shepherd": "^19.0.2",
    "autolinker": "^4.0.0",
    "bootstrap": "^4.1.3",
    "browser-xml2js": "^0.4.19",
    "buffer": "^5.6.0",
    "check-password-strength": "^2.0.7",
    "cldr-data": "^36.0.1",
    "core-js": "^3.33.2",
    "crypto-js": "^4.2.0",
    "date-fns": "^2.30.0",
    "dompurify": "^3.0.6",
    "encoding": "^0.1.13",
    "evaljs": "^2.0.1",
    "exponential-backoff": "^3.1.1",
    "file-type-mime": "^0.4.5",
    "fix-utf8": "^2.0.0",
    "fuse.js": "^7.0.0",
    "jest-sonar-reporter": "^2.0.0",
    "jsbarcode": "^3.11.6",
    "jszip": "^3.10.1",
    "kjua-svg": "^1.13.1",
    "leven": "^4.0.0",
    "libphonenumber-js": "^1.10.49",
    "lodash": "^4.17.21",
    "md5js": "^1.0.7",
    "moment": "^2.29.4",
    "ng-mocks": "^14.11.0",
    "ng-recaptcha-2": "15.0.3",
    "ngx-barcode6": "^1.0.23",
    "ngx-drag-drop": "19.0.0",
    "ngx-kjua": "^17.0.0",
    "ngx-toastr": "^17.0.2",
    "ngx-trim-directive": "^3.0.0",
    "node-forge": "^1.3.1",
    "pako": "^2.1.0",
    "pdfmake": "0.2.10",
    "pretty-print-json": "^2.1.1",
    "read-excel-file": "^5.7.1",
    "roboto-fontface": "^0.10.0",
    "rrule": "^2.8.1",
    "rtf.js": "^3.0.9",
    "rxjs": "^7.4.0",
    "rxjs-compat": "^6.6.7",
    "safe-pipe": "^3.0.4",
    "serialize-error": "^11.0.3",
    "showdown": "2.1.0",
    "tslib": "^2.6.2",
    "util": "^0.12.5",
    "uuid": "^9.0.1",
    "vkbeautify": "^0.99.3",
    "whatwg-fetch": "^3.6.19",
    "yaml": "^2.3.4",
    "zone.js": "0.15.1",
    "typescript": "5.8.3"
    },
    "devDependencies": {
    "@angular-devkit/build-angular": "19.2.14",
    "@angular-devkit/core": "19.2.14",
    "@angular-devkit/schematics": "19.2.14",
    "@angular-eslint/eslint-plugin": "19.8.0",
    "@angular/cli": "19.2.14",
    "@angular/compiler-cli": "19.2.14",
    "@angular/language-service": "19.2.14",
    "@ngxs/devtools-plugin": "19.0.0",
    "@nx/angular": "20.5.0",
    "@nx/jest": "20.5.0",
    "@nx/workspace": "20.5.0",
    "@schematics/angular": "17.3.8",
    "@types/jest": "^29.5.8",
    "@types/node": "18.19.9",
    "@typescript-eslint/eslint-plugin": "^6.11.0",
    "@typescript-eslint/parser": "^6.11.0",
    "cross-env": "^7.0.3",
    "csv-writer": "^1.6.0",
    "eslint": "^8.53.0",
    "eslint-config-prettier": "^9.0.0",
    "eslint-plugin-import": "^2.29.0",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-sonarjs": "^0.23.0",
    "fs-extra": "^11.1.1",
    "git-describe": "^4.1.1",
    "husky": "^4.3.8",
    "jest": "29.5.0",
    "jest-environment-jsdom": "29.5.0",
    "jest-preset-angular": "14.6.1",
    "lint-staged": "^15.1.0",
    "neat-csv": "^7.0.0",
    "ng-packagr": "19.2.2",
    "npm-run-all": "^4.1.5",
    "nx": "19.3.0",
    "nx-cloud": "19.0.0",
    "prettier": "^3.1.0",
    "terser": "^5.24.0",
    "ts-node": "10.9.1"
    },
    "optionalDependencies": {
    "@nx/nx-darwin-arm64": "20.5.0",
    "@nx/nx-darwin-x64": "20.5.0",
    "@nx/nx-linux-x64-gnu": "20.5.0",
    "@nx/nx-win32-x64-msvc": "20.5.0"
    },
    "resolutions": {
    "uglify-es": "npm:terser",
    "uglify-js": "npm:terser"
    },
    "browser": {
    "fs": false,
    "os": false,
    "path": false
    }


    tsconfig.json

    {
    "compileOnSave": false,
    "compilerOptions": {
    "maxNodeModuleJsDepth": 0,
    "allowImportingTsExtensions": true,
    "noEmit": true,
    "resolveJsonModule": true,
    "skipLibCheck": true,
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "forceConsistentCasingInFileNames": true,
    "target": "ES2022",
    "module": "ES2022",
    "typeRoots": ["node_modules/@types"],
    "esModuleInterop": true,
    "baseUrl": "./",
    "paths": {
    ...
    },
    "rootDir": ".",
    "strict": true,
    "alwaysStrict": true,
    "strictBindCallApply": false,
    "strictFunctionTypes": false,
    "strictNullChecks": false,
    "strictPropertyInitialization": false,
    "noImplicitAny": false,
    "noImplicitThis": true,
    "useDefineForClassFields": false
    },
    "exclude": ["node_modules", "tmp"],
    }


    angular.json

    "<app1>": {
    "root": "apps/<app1>/",
    "sourceRoot": "apps/<app1>/src",
    "projectType": "application",
    "prefix": "ms",
    "schematics": {
    "@schematics/angular:component": {
    "style": "scss"
    }
    },
    "architect": {
    "build": {
    "builder": "@angular-devkit/build-angular:application",
    "options": {
    "outputHashing": "all",
    "stylePreprocessorOptions": {
    "includePaths": ["apps/<app1>/src/styles"]
    },
    "outputPath": "dist/apps/<app1>",
    "index": "apps/<app1>/src/index.html",
    "browser": "apps/<app1>/src/main.ts",
    "polyfills": ["apps/<app1>/src/polyfills.ts"],
    "tsConfig": "apps/<app1>/tsconfig.app.json",
    "assets": [
    "apps/<app1>/src/favicon.ico",
    "apps/<app1>/src/assets",
    "apps/<app1>/src/env.js",
    "apps/<app1>/src/manifest.json"
    ],
    "styles": ["apps/<app1>/src/styles.scss"],
    "scripts": ["node_modules/moment/moment.js"],
    "allowedCommonJsDependencies": [
    "@progress/kendo-angular-intl/locales/fr-BE/all",
    "@progress/kendo-angular-intl/locales/fr-BE/calendar",
    "@progress/kendo-angular-intl/locales/nl-BE/all",
    "@progress/kendo-angular-intl/locales/de-BE/all",
    "lodash",
    "big-integer",
    "@antoinepairet/iban-bic-belgium/bic-from-iban",
    "browser-xml2js",
    "encoding",
    "jsbarcode",
    "jschardet",
    "ngx-barcode6",
    "ngx-kjua",
    "evaljs",
    "p-limit",
    "pako",
    "pdfmake",
    "exponential-backoff",
    "pdfjs-dist",
    "rxjs",
    "moment",
    "jszip",
    "vkbeautify",
    "kjua-svg",
    "chardet",
    "rxjs-compat/Subscription",

    ],
    "aot": false,
    "extractLicenses": false,
    "sourceMap": true,
    "optimization": false,
    "namedChunks": true,
    "baseHref": "./"
    },
    "configurations": {
    "production": {
    "fileReplacements": [
    {
    "replace": "apps/<app1>/src/environments/environment.ts",
    "with": "apps/<app1>/src/environments/environment.prod.ts"
    },
    {
    "replace": "apps/<app1>/src/env.js",
    "with": "apps/<app1>/src/env_prod.js"
    }
    ],
    "outputHashing": "all",
    "sourceMap": false,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": false,
    "buildOptimizer": true,
    "serviceWorker": true
    }
    },
    "outputs": ["{options.outputPath}"],
    "defaultConfiguration": ""
    },
    "serve": {
    "builder": "@angular-devkit/build-angular:dev-server",
    "options": {
    "buildTarget": "<app1>:build"
    },
    "configurations": {
    "production": {
    "buildTarget": "<app1>:build:production"
    }
    }
    },
    "extract-i18n": {
    "builder": "@angular-devkit/build-angular:extract-i18n",
    "options": {
    "buildTarget": "<app1>:build"
    }
    },
    "lint": {
    "builder": "@angular-devkit/build-angular:tslint",
    "options": {
    "tsConfig": ["apps/<app1>/tsconfig.app.json", "apps/<app1>/tsconfig.spec.json"],
    "exclude": ["**/node_modules/**"]
    }
    },
    "test": {
    "builder": "@nx/jest:jest",
    "options": {
    "jestConfig": "apps/<app1>/jest.config.ts",
    "passWithNoTests": true
    },
    "outputs": ["coverage/apps/<app1>/"]
    }
    }
    },


    I'd like to run the application normally as we did before. In these files above, there's a lot of solutions that I've seen online but did not work.

    Any help would be greatly appreciated, as I'm running out of ideas on how to fix this problem, and we have a deadline (29th) as one of the services we use, will deprecate older versions of Angular (< 19).

    Thank you so very much in advance.

    Continue reading...

Compartilhe esta Página