manfredsteyer / ngx-build-plus

Extend the Angular CLI's default build behavior without ejecting, e. g. for Angular Elements
1.19k stars 136 forks source link

Different bundle is built on consecutive builds #186

Open ale-coe opened 4 years ago

ale-coe commented 4 years ago

I'm using ngx-build-plus to build a standalone (angular) component like describe here: https://www.angulararchitects.io/aktuelles/your-options-for-building-angular-elements/. Since my update to Angular 9 I've noticed a strange behaviour that wasn't happening with Angular 8: I change something inside my standalone component and build it using ngx-build-plus. Everything works fine. Then I do a second build without having changed anything in my component and now the resulting bundle has a different content. E.g. it contains a function '_wrapNativeSuper' that the working bundle does not contain. I tried turning off ivy for this project but that wasn't helping. What seems to help is a 'rm -rf node'_modules/ && npm install' before each build.

"dependencies": {
    "@angular/animations": "^9.1.3",
    "@angular/cdk": "^9.2.1",
    "@angular/common": "^9.1.3",
    "@angular/compiler": "^9.1.3",
    "@angular/core": "^9.1.3",
    "@angular/elements": "^9.1.3",
    "@angular/flex-layout": "9.0.0-beta.29",
    "@angular/forms": "^9.1.3",
    "@angular/material": "^9.2.1",
    "@angular/material-moment-adapter": "^9.2.1",
    "@angular/platform-browser": "^9.1.3",
    "@angular/platform-browser-dynamic": "^9.1.3",
    "@angular/router": "^9.1.3",
    "@nrwl/angular": "^9.2.3",
    "@sentry/browser": "^5.12.1",
    "@webcomponents/custom-elements": "^1.3.2",
    "angularx-qrcode": "~2.2.1",
    "breakpoint-sass": "^2.7.1",
    "core-js": "^3.4.1",
    "file-saver": "^2.0.2",
    "moment": "^2.24.0",
    "ngx-cookie-service": "^2.3.0",
    "ngx-extended-pdf-viewer": "3.2.3",
    "reflect-metadata": "^0.1.13",
    "rxjs": "6.5.5",
    "sass-ems": "^1.0.3",
    "tslib": "^1.10.0",
    "typeorm": "^0.2.15",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^8.4.1",
    "@angular-devkit/build-angular": "~0.901.3",
    "@angular/cli": "^9.1.3",
    "@angular/compiler-cli": "~9.1.3",
    "@angular/language-service": "^9.1.3",
    "@fortawesome/fontawesome-pro": "^5.12.0",
    "@nrwl/cli": "^9.2.3",
    "@nrwl/cypress": "^9.2.3",
    "@nrwl/jest": "^9.2.3",
    "@nrwl/workspace": "^9.2.3",
    "@sentry/cli": "^1.51.0",
    "@types/file-saver": "^2.0.1",
    "@types/jest": "25.1.4",
    "@types/jquery": "3.3.6",
    "codelyzer": "^5.1.2",
    "cypress": "^3.6.1",
    "dotenv": "6.2.0",
    "jest": "25.2.4",
    "jest-junit-reporter": "^1.1.0",
    "jest-preset-angular": "8.1.3",
    "js-base64": "2.5.1",
    "ng2-mock-component": "0.1.1",
    "ngx-build-plus": "^9.0.6",
    "npm-run-all": "^4.1.5",
    "prettier": "1.19.1",
    "ts-jest": "25.2.1",
    "ts-node": "~7.0.0",
    "tslint": "6.0.0",
    "typescript": "3.8.3"
  }

command to build component: "build:custom-element": "ng build custom-element --prod --outputHashing=none --single-bundle=true --vendor-chunk=false && ...cat files and move to specific directory...",

from angular.json:

"architect": {
        "build": {
          "builder": "ngx-build-plus:build",
mclighter commented 3 years ago

I have the same problem, have you found a solution?