cherryApp/ngc-esbuild

Support Angular Material (or SCSS?)

Closed this issue · 4 comments

I have tried this package on some simple projects. The speed is awesome!

But in some project using Angular Material, will get many error messages.

image

Thanks for your feedback.
Please send us the whole file, I will check it in my test environment.

I have create a simple project for this problem.

https://github.com/wellwind/ngc-esbuild-material-error-demo

I just installed @angular/material, then add one line into app.component.scss

@use '@angular/material' as mat;

Followed by instruction of Angular Material doc: https://material.angular.io/guide/theming

The full error message:

✘ [ERROR] [plugin angularCSSProcessor] Can't find stylesheet to import.
  ╷
1 │ @use '@angular/material' as mat;
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/app/app.component.scss 1:1  root stylesheet

    src/app/app.component.ts:1:7:
      1 │ import './app.component.scss';
        ╵        ~~~~~~~~~~~~~~~~~~~~~~

  This error came from the "onLoad" callback registered here:

    ../../.npm/_npx/70728/lib/node_modules/ngc-esbuild/bin/plugin/esbuild-css-resolver.js:72:12:
      72 │       build.onLoad({ filter: /.*/, namespace: 'sass' }, async args => {
         ╵             ~~~~~~

    at setup (/Users/wellwind/.npm/_npx/70728/lib/node_modules/ngc-esbuild/bin/plugin/esbuild-css-resolver.js:72:13)
    at handlePlugins (/Users/wellwind/.npm/_npx/70728/lib/node_modules/ngc-esbuild/node_modules/esbuild/lib/main.js:814:23)

(node:70728) UnhandledPromiseRejectionWarning: Error: Build failed with 1 error:
src/app/app.component.ts:1:7: ERROR: [plugin: angularCSSProcessor] Can't find stylesheet to import.
  ╷
1 │ @use '@angular/material' as mat;
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  src/app/app.component.scss 1:1  root stylesheet
    at failureErrorWithLog (/Users/wellwind/.npm/_npx/70728/lib/node_modules/ngc-esbuild/node_modules/esbuild/lib/main.js:1557:15)
    at /Users/wellwind/.npm/_npx/70728/lib/node_modules/ngc-esbuild/node_modules/esbuild/lib/main.js:1215:28
(Use `node --trace-warnings ...` to show where the warning was created)
(node:70728) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:70728) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Thanks :)

Thanks, I am working on it.

I created a patch for this problem.
Please update the package:

npm i ngc-esbuild@0.0.59 -D

Try it and give me feedback.
Thanks.