Skip to content

Bug: compilation error with Sass and Symfony Webpack Encore #174

Answered by GrimLink
bricebou asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bricebou, I believe I may have found a solution to your issue. It appears that you need to set the include path to ensure that all node relative paths are handled correctly when using sass-loader.

The problem seems to be related to how sass-loader handles imports from node_modules. In both cases that I tested (with Webpack and Encore), passing includePaths: ["node_modules"] was necessary, just like when using sass directly.

To fix your issue, please add the following code to your configuration:

const Encore = require('@symfony/webpack-encore');

// Other Encore options

Encore
  // Other Encore options

  .enableSassLoader((options) => {
    options.sassOptions = {
      includePaths: [

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by bricebou
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Something that adds or needs more documentation question This not a bug but a question instead
2 participants
Converted from issue

This discussion was converted from issue #168 on May 01, 2023 08:48.