angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.74k stars 11.98k forks source link

Angular12 with scsss, `ng build {my-library}` froze and doesn't any response. #20726

Closed rms-shinse closed 3 years ago

rms-shinse commented 3 years ago

🐞 Bug report

Command (mark with an x)

Is this a regression?

No

Description

When I use scss(inlineStyleLanguage) in my library, the command ng build {my-library} froze and doesn't any response.

πŸ”¬ Minimal Reproduction

angular.json

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "ui": {
      "projectType": "library",
      "schematics": {
        "@schematics/angular:component": {
          "style": "scss"
        }
      },
      "root": "projects/ui",
      "sourceRoot": "projects/ui/src",
      "prefix": "ui",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:ng-packagr",
          "options": {
            "project": "projects/ui/ng-package.json"
          },
          "configurations": {
            "production": {
              "tsConfig": "projects/ui/tsconfig.lib.prod.json"
            },
            "development": {
              "tsConfig": "projects/ui/tsconfig.lib.json"
            }
          },
          "inlineStyleLanguage": "scss",
          "defaultConfiguration": "production"
        },
      }
    }
  }
}

projects/ui/src/public-api.ts

export * from './lib/ui.component';

projects/ui/src/lib/ui.component.ts

import { Component, Input } from '@angular/core';

@Component({
  selector: 'ui-ui',
  template: 'hello',
  styleUrls: ['./ui.component.scss'],
})
export class UiComponent {}

projects/ui/src/lib/ui.component.scss

πŸ”₯ Exception or Error

I run "ng build", and nothings happen (no response).


$ yarn run ng build ui
yarn run v1.22.10
$ ng build ui
Building Angular Package

------------------------------------------------------------------------------
Building entry point '@sandbox/ui'
------------------------------------------------------------------------------
β ‹ Compiling TypeScript sources through NGC

🌍 Your Environment


$ yarn run ng version
yarn run v1.22.10
$ ng version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 12.0.0-rc.2
Node: 14.16.1
Package Manager: yarn 1.22.10
OS: darwin x64

Angular: 12.0.0-rc.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.0-rc.2
@angular-devkit/build-angular   12.0.0-rc.2
@angular-devkit/core            12.0.0-rc.2
@angular-devkit/schematics      12.0.0-rc.2
@angular/elements               11.2.13
@schematics/angular             12.0.0-rc.2
ng-packagr                      12.0.0-rc.2
rxjs                            6.6.7
typescript                      4.2.4

✨  Done in 2.98s.

sass versions

$ cat yarn.lock | grep sass
    sass "1.32.12"
    sass-loader "11.0.1"
    node-sass-tilde-importer "^1.0.2"
    sass "^1.32.8"
node-sass-tilde-importer@^1.0.2:
  resolved "https://registry.yarnpkg.com/node-sass-tilde-importer/-/node-sass-tilde-importer-1.0.2.tgz#1a15105c153f648323b4347693fdb0f331bad1ce"
sass-loader@11.0.1:
  resolved "https://registry.yarnpkg.com/sass-loader/-/sass-loader-11.0.1.tgz#8672f896593466573b904f47693e0695368e38c9"
sass@1.32.12, sass@^1.32.8:
  resolved "https://registry.yarnpkg.com/sass/-/sass-1.32.12.tgz#a2a47ad0f1c168222db5206444a30c12457abb9f"
alan-agius4 commented 3 years ago

inlineStyleLanguage is only supported in application projects.

That said this shouldn't freeze the build.

rms-shinse commented 3 years ago

@alan-agius4 I see, and removed that. But ng build still does not any response. What's happen? Is this the problem of angular-cli or relevant libraries (like webpack5 or sass)?

angular.json

-           "inlineStyleLanguage": "scss",
alan-agius4 commented 3 years ago

it appears to be a bug in https://github.com/ng-packagr/ng-packagr

I'll land a fix soon.

angular-automatic-lock-bot[bot] commented 3 years ago

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.