Giter Site home page Giter Site logo

Comments (7)

aigoncharov avatar aigoncharov commented on June 15, 2024

What version of angular and angular devtools are you using?
Please provide your package.json, package-lock.json and angular.json.

from angular-builder-custom-terser-options.

steosoft avatar steosoft commented on June 15, 2024

package.json:

{
  "name": "xxxxx",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^7.2.4",
    "@angular/cdk": "^7.3.1",
    "@angular/common": "^7.2.4",
    "@angular/compiler": "^7.2.4",
    "@angular/core": "^7.2.4",
    "@angular/flex-layout": "^7.0.0-beta.23",
    "@angular/forms": "^7.2.4",
    "@angular/http": "^7.2.4",
    "@angular/material": "^7.3.1",
    "@angular/platform-browser": "^7.2.4",
    "@angular/platform-browser-dynamic": "^7.2.4",
    "@angular/platform-server": "^7.2.4",
    "@angular/router": "^7.2.4",
    "@asymmetrik/ngx-leaflet": "^4.0.0",
    "@ngtools/webpack": "^7.3.0",
    "@types/node": "^10.12.21",
    "angular-resizable-element": "^3.2.3",
    "angular2-draggable": "^1.4.2",
    "circular-json": "^0.5.4",
    "core-js": "^2.6.3",
    "hammerjs": "^2.0.8",
    "jquery": "^3.3.1",
    "keycloak-angular": "^6.0.0",
    "leaflet": "^1.4.0",
    "lodash": "^4.17.10",
    "ng2-dragula": "^1.5.0",
    "rxjs": "^6.4.0",
    "ts-md5": "^1.2.4",
    "typings": "^2.1.1",
    "zone.js": "^0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.13.0",
    "@angular/cli": "^7.3.0",
    "@angular/compiler-cli": "^7.2.4",
    "@angular/language-service": "^7.2.4",
    "@types/jasmine": "^2.8.16",
    "@types/jasminewd2": "~2.0.2",
    "@types/leaflet": "^1.4.1",
    "angular-builder-custom-terser-options": "^1.0.1",
    "codelyzer": "^4.3.0",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^2.0.2",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.4.2",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "3.2.4",
    "webpack": "^4.29.1"
  }
}

angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "xxxxx": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "angular-builder-custom-terser-options:browser-custom-terser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.app.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              {
                "glob": "**/*",
                "input": "node_modules/leaflet/dist/images",
                "output": "/leaflet"
              },
              "src/assets",
              "src/favicon.ico"
            ],
            "styles": [
              "src/styles.css",
              "node_modules/leaflet/dist/leaflet.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js"
            ]
          },
          "configurations": {
            "production": {
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "terserOptions": {
                "keep_classnames": ".*Component",
                "keep_fnames": ".*Component"
              }
            }
          }
        },
        "serve": {
          "builder": "angular-builder-custom-terser-options:dev-server-custom-terser",
          "options": {
            "browserTarget": "xxxxx:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "xxxxx:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "xxxxx:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "src/test.ts",
            "karmaConfig": "./karma.conf.js",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "src/tsconfig.spec.json",
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js"
            ],
            "styles": [
              "src/styles.css",
              "node_modules/leaflet/dist/leaflet.css"
            ],
            "assets": [
              {
                "glob": "**/*",
                "input": "node_modules/leaflet/dist/images",
                "output": "/leaflet"
              },
              "src/assets",
              "src/favicon.ico"
            ]
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "src/tsconfig.app.json",
              "src/tsconfig.spec.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    },
    "xxxxx-e2e": {
      "root": "",
      "sourceRoot": "",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@angular-devkit/build-angular:protractor",
          "options": {
            "protractorConfig": "./protractor.conf.js",
            "devServerTarget": "xxxxx:serve"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "e2e/tsconfig.e2e.json"
            ],
            "exclude": [
              "**/node_modules/**"
            ]
          }
        }
      }
    }
  },
  "defaultProject": "xxxxx",
  "schematics": {
    "@schematics/angular:component": {
      "prefix": "app",
      "styleext": "css"
    },
    "@schematics/angular:directive": {
      "prefix": "app"
    }
  }
}

from angular-builder-custom-terser-options.

aigoncharov avatar aigoncharov commented on June 15, 2024

I tried to come up with a demo to reproduce your case, but it works for me.
Take a look.

Could you provide a repo or stackblitz demo with a minimal reproduction of your issue?

from angular-builder-custom-terser-options.

steosoft avatar steosoft commented on June 15, 2024

I took a closer look at the issue and if I create new configuration (let's call it "debug") and set only one flag "aot": true then it works fine

          "configurations": {
            "debug": {
              "aot": true
            },
            "production": {
              [...]
            }
          }

ng serve --configuration=debug = everything works correct, no exceptions in console

Any idea what is going on there?

from angular-builder-custom-terser-options.

aigoncharov avatar aigoncharov commented on June 15, 2024

Based on your error message it seems like DefaultStyleDirective is not injected in non-aot mode. I had a weird problem related to missing services when I used barrel files. Do you use barrels?

from angular-builder-custom-terser-options.

steosoft avatar steosoft commented on June 15, 2024

I have checked the code but I don't see there any barrel files.

from angular-builder-custom-terser-options.

aigoncharov avatar aigoncharov commented on June 15, 2024

@steosoft could try to come with a repo with a minimal setup to reproduce the issue?

from angular-builder-custom-terser-options.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.