Skip to content
New issue

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

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

Already on GitHub? # to your account

Enable gatsby-plugin-sass to allow sass-embedded #38987

Open
2 tasks done
Schweinepriester opened this issue May 22, 2024 · 1 comment
Open
2 tasks done

Enable gatsby-plugin-sass to allow sass-embedded #38987

Schweinepriester opened this issue May 22, 2024 · 1 comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@Schweinepriester
Copy link

Preliminary Checks

Description

sass-loader was recently updated to v14.2.0

14.2.0 (2024-04-11)

Features

  • added the modern-compiler value for API to reuse compiler process (#1195) (cef40a8)
  • support webpack built-in resolver for modern and modern-compiler API (#1197) (2265b72)

Notes:

Using the modern-compiler value for the api option together with sass-embedded reduces compilation time by 5-10 times, especially for projects using large files with a lot of @import/@use, for small files the build time reduction will not be significant.

but it's not possible to use that with gatsby-plugin-sass, since it uses ^10.4.1, see

"sass-loader": "^10.4.1"

resulting in

Unknown Sass implementation "sass-embedded".

when attempting to do so.

It would be great if gatsby-plugin-sass would be enabled to utilized sass-embedded, gaining the (potential) performance improvements.

Reproduction Link

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-sass/package.json#L12

Steps to Reproduce

  1. Attempt to use sass-embedded, e.g.

    {
      resolve: 'gatsby-plugin-sass',
      options: {
        implementation: require('sass-embedded'),
        sassOptions: {
          api: 'modern-compiler',
        },
      },
    },

    in the plugins array.

  2. See build log

Expected Result

Works

Actual Result

Unknown Sass implementation "sass-embedded".

Environment

Everywhere

Config Flags

No response

@Schweinepriester Schweinepriester added the type: bug An issue or pull request relating to a bug in Gatsby label May 22, 2024
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 22, 2024
@Kearnol
Copy link

Kearnol commented Oct 21, 2024

To add on here, our project is also currently getting the following warning when using gatsby-plugin-sass with sass v1.79.1
Deprecation Warning: The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0.

The plugin should allow the user to specify the api property as modern or mondern-compiler under sassOptions, but given that the current version of sass-loader used by the plugin is ~10.4.1, this option is not supported.

Please update the sass-loader dependency so that the api option can be configured and this warning can be addressed.

See: https://sass-lang.com/documentation/breaking-changes/legacy-js-api/

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants