Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined:14:952802: missing '}' #21726

Closed
1 of 15 tasks
GlauberF opened this issue Sep 8, 2021 · 7 comments
Closed
1 of 15 tasks

undefined:14:952802: missing '}' #21726

GlauberF opened this issue Sep 8, 2021 · 7 comments

Comments

@GlauberF
Copy link

GlauberF commented Sep 8, 2021

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Description

By changing my settings to this in my angular.json.

"optimization": {
    "scripts": true,
    "styles": {
        "minify": true,
        "inlineCritical": false
    },
    "fonts": true
}

I start getting the following error:

Error: undefined:14:952802: missing '}'
    at error (/var/www/html/pwa_vimbo/dist/server/main.js:1:4024947)
    at declarations (/var/www/html/pwa_vimbo/dist/server/main.js:1:4027076)
    at rule (/var/www/html/pwa_vimbo/dist/server/main.js:1:4030831)
    at rules (/var/www/html/pwa_vimbo/dist/server/main.js:1:4025487)
    at stylesheet (/var/www/html/pwa_vimbo/dist/server/main.js:1:4025183)
    at Object.parse$1 [as parse] (/var/www/html/pwa_vimbo/dist/server/main.js:1:4030976)
    at parseStylesheet (/var/www/html/pwa_vimbo/dist/server/main.js:1:4244805)
    at CrittersExtended.processStyle (/var/www/html/pwa_vimbo/dist/server/main.js:1:4255256)
    at /var/www/html/pwa_vimbo/dist/server/main.js:1:4248407
    at Array.map (<anonymous>)

looking deeper, the cause of the problem is css optimization, it removes all, example

@media all {
    /* Never show page breaks in normal view */
    .page-break-after,
    .page-break-before {
        display: none;
    }
}

transform to

@media{.page-break-after,.page-break-before{display:none}}

media without all is invalid, returning error

There is a workaround.

🌍 Your Environment


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 12.2.4
Node: 14.16.1
Package Manager: npm 6.14.12
OS: linux x64

Angular: 12.2.3
... animations, cdk, common, compiler, core, forms, material
... material-moment-adapter, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1202.4
@angular-devkit/build-angular     12.2.4
@angular-devkit/build-optimizer   0.1101.4
@angular-devkit/core              12.2.4
@angular-devkit/schematics        12.2.4
@angular/cli                      12.2.4
@angular/compiler-cli             12.2.4
@angular/flex-layout              12.0.0-beta.34
@angular/language-service         12.2.4
@nguniversal/builders             12.1.0
@nguniversal/express-engine       12.1.0
@schematics/angular               12.2.4
rxjs                              6.6.7
typescript                        4.3.5

@alan-agius4
Copy link
Collaborator

Same root cause of #20760

@GlauberF
Copy link
Author

GlauberF commented Sep 8, 2021

in the mentioned solution, you comment on disabling inlineCritical, but it is disabled and the error after the build continues.

{
    "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
    "version": 1,
    "newProjectRoot": "projects",
    "projects": {
        "vimbo": {
            "projectType": "application",
            "schematics": {
                "@schematics/angular:component": {
                    "style": "scss"
                },
                "@schematics/angular:application": {
                    "strict": true
                }
            },
            "root": "",
            "sourceRoot": "src",
            "prefix": "app",
            "architect": {
                "build": {
                    "builder": "@angular-devkit/build-angular:browser",
                    "options": {
                        "outputPath": "dist/browser",
                        "index": "src/index.html",
                        "main": "src/main.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.app.json",
                        "inlineStyleLanguage": "scss",
                        "serviceWorker": true,
                        "ngswConfigPath": "ngsw-config.json",
                        "assets": [
                            "src/robots.txt",
                            "src/favicon.ico",
                            "src/assets",
                            "src/manifest.webmanifest",
                            "src/manifest.webmanifest",
                            {
                                "glob": "**/*",
                                "input": "node_modules/ngx-monaco-editor/assets/monaco",
                                "output": "./assets/monaco/"
                            }
                        ],
                        "styles": ["src/styles.scss", "./node_modules/froala-editor/css/froala_editor.pkgd.min.css"],
                        "scripts": ["src/assets/js/block-inspect-element-vimbo.js", "src/assets/js/listening-postmesage.js"]
                    },
                    "configurations": {
                        "production": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ],
                            "outputHashing": "all",
                            "budgets": [
                                {
                                    "type": "bundle",
                                    "name": "polyfills",
                                    "baseline": "150kb",
                                    "maximumWarning": "50kb",
                                    "maximumError": "100kb"
                                },
                                {
                                    "type": "bundle",
                                    "name": "styles",
                                    "baseline": "1.4mb",
                                    "maximumWarning": "600kb",
                                    "maximumError": "900kb"
                                },
                                {
                                    "type": "bundle",
                                    "name": "main",
                                    "baseline": "2.5mb",
                                    "maximumWarning": "3mb",
                                    "maximumError": "4mb"
                                },
                                {
                                    "type": "initial",
                                    "maximumWarning": "5mb",
                                    "maximumError": "6.5mb"
                                },
                                {
                                    "type": "anyComponentStyle",
                                    "maximumWarning": "15kb",
                                    "maximumError": "35kb"
                                }
                            ],
                            "optimization": {
                                "scripts": true,
                                "styles": {
                                    "minify": true,
                                    "inlineCritical": false
                                },
                                "fonts": true
                            }
                        },
                        "ec": {
                            "sourceMap": true,
                            "extractCss": true
                        },
                        "hmr": {
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.hmr.ts"
                                }
                            ]
                        },
                        "development": {
                            "buildOptimizer": false,
                            "optimization": false,
                            "vendorChunk": true,
                            "extractLicenses": false,
                            "sourceMap": true,
                            "namedChunks": true
                        }
                    },
                    "defaultConfiguration": "production"
                },
                "serve": {
                    "builder": "@angular-devkit/build-angular:dev-server",
                    "configurations": {
                        "production": {
                            "browserTarget": "vimbo:build:production"
                        },
                        "hmr": {
                            "hmr": true,
                            "browserTarget": "vimbo:build:hmr"
                        },
                        "ec": {
                            "browserTarget": "vimbo:build:ec"
                        },
                        "development": {
                            "browserTarget": "vimbo:build:development"
                        }
                    },
                    "defaultConfiguration": "development"
                },
                "extract-i18n": {
                    "builder": "@angular-devkit/build-angular:extract-i18n",
                    "options": {
                        "browserTarget": "vimbo:build"
                    }
                },
                "test": {
                    "builder": "@angular-devkit/build-angular:karma",
                    "options": {
                        "main": "src/test.ts",
                        "polyfills": "src/polyfills.ts",
                        "tsConfig": "tsconfig.spec.json",
                        "karmaConfig": "karma.conf.js",
                        "assets": ["src/favicon.ico", "src/assets", "src/manifest.webmanifest"],
                        "styles": ["src/styles.scss"],
                        "scripts": []
                    }
                },
                "lint": {
                    "builder": "@angular-devkit/build-angular:tslint",
                    "options": {
                        "tsConfig": ["tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json"],
                        "exclude": ["**/node_modules/**", "**/src/app/fake-db/**/*", "**/src/assets/angular-material-examples/**/*", "**/@schematics/**"]
                    }
                },
                "e2e": {
                    "builder": "@angular-devkit/build-angular:protractor",
                    "options": {
                        "protractorConfig": "e2e/protractor.conf.js",
                        "devServerTarget": "vimbo:serve"
                    },
                    "configurations": {
                        "production": {
                            "devServerTarget": "vimbo:serve:production"
                        }
                    }
                },
                "server": {
                    "builder": "@angular-devkit/build-angular:server",
                    "options": {
                        "outputPath": "dist/server",
                        "main": "server.ts",
                        "tsConfig": "tsconfig.server.json",
                        "inlineStyleLanguage": "scss"
                    },
                    "configurations": {
                        "production": {
                            "outputHashing": "media",
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                }
                            ]
                        },
                        "development": {
                            "optimization": false,
                            "sourceMap": true,
                            "extractLicenses": false
                        }
                    },
                    "defaultConfiguration": "production"
                },
                "serve-ssr": {
                    "builder": "@nguniversal/builders:ssr-dev-server",
                    "configurations": {
                        "development": {
                            "browserTarget": "vimbo:build:development",
                            "serverTarget": "vimbo:server:development"
                        },
                        "production": {
                            "browserTarget": "vimbo:build:production",
                            "serverTarget": "vimbo:server:production"
                        }
                    },
                    "defaultConfiguration": "development"
                },
                "prerender": {
                    "builder": "@nguniversal/builders:prerender",
                    "options": {
                        "routes": ["/"]
                    },
                    "configurations": {
                        "production": {
                            "browserTarget": "vimbo:build:production",
                            "serverTarget": "vimbo:server:production"
                        },
                        "development": {
                            "browserTarget": "vimbo:build:development",
                            "serverTarget": "vimbo:server:development"
                        }
                    },
                    "defaultConfiguration": "production"
                }
            }
        }
    },
    "defaultProject": "vimbo",
    "cli": {
        "analytics": false
    }
}

@alan-agius4
Copy link
Collaborator

In your case you also need to disable inline critical css from the Universal express engine.

    ngExpressEngine({
      bootstrap: AppServerModule,
      inlineCriticalCss: false,
    }),

@Local9
Copy link

Local9 commented Sep 8, 2021

I have the same type of message, I've reverted back to v11 for now as I've tried everything that everyone has said and still get the same type of message. Its not a priority for me to upgrade to v12 just yet, but I do wish the message had more information. I also do not have ngExpressEngine in my project.

@GlauberF
Copy link
Author

GlauberF commented Sep 8, 2021

@alan-agius4
If I enter the option it is not compatible with the expected type

Captura de Tela_20210908131316

@alan-agius4
Copy link
Collaborator

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants