Skip to content

[6.0] improve error message compilation scss #45906

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

Open
wants to merge 3 commits into
base: 6.0-dev
Choose a base branch
from

Conversation

hans2103
Copy link
Contributor

Pull Request for no issue

Summary of Changes

We're clueless when working on a failed scss to css compilation.
This PR will adjust the error message thrown with a reference to the error and the file.

Testing Instructions

  • open build/media_source/com_media/scss/media-manager.scss and make a typo in @import "variables";
    • reason is to be sure that the scss to css will fail
    • I've changes variables to vacriables
  • run npm run build:css
    • compilation will fail
  • apply this patch
  • run npm run build:css
    • compilation will fail
  • compare the error messages before and after applying this patch.

Actual result BEFORE applying this Pull Request

file:///path/to/joomla/build/build-modules-js/stylesheets/handle-scss.mjs:19
    throw new Error(error.formatted);
          ^

Error
    at handleScssFile (file:///path/to/joomla/build/build-modules-js/stylesheets/handle-scss.mjs:19:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Expected result AFTER applying this Pull Request

node:internal/process/promises:391
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error: Error: Can't find stylesheet to import.
  ╷
2 │ @import "vacriables";
  │         ^^^^^^^^^^^^
  ╵
  ../../../../build/media_source/com_media/scss/media-manager.scss 2:9  root stylesheet
    at handleCompileResponse (/path/to/joomla/public_html/node_modules/sass-embedded/dist/lib/src/compiler/utils.js:155:15)
    at AsyncCompiler.compileRequestAsync (/path/to/joomla/node_modules/sass-embedded/dist/lib/src/compiler/async.js:100:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async compileAsync (/path/to/joomla/node_modules/sass-embedded/dist/lib/src/compile.js:36:16)
    at async handleScssFile (file:///path/to/joomla/build/build-modules-js/stylesheets/handle-scss.mjs:16:21)

With this error message I can find the failure easier then before.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@hans2103 hans2103 changed the base branch from 5.3-dev to 6.0-dev August 14, 2025 07:14
@bembelimen bembelimen added the bug label Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants