Skip to content
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

Can't enable SASS on Adobe Magento PWA #110

Open
amin-arabi opened this issue Feb 16, 2022 · 0 comments
Open

Can't enable SASS on Adobe Magento PWA #110

amin-arabi opened this issue Feb 16, 2022 · 0 comments
Assignees

Comments

@amin-arabi
Copy link

Issue in /src/pages/tutorials/basic-modifications/enable-sass-less/index.md
Issue in injected react component, with .scss file imported and used.
The component is very simple. I've only styled a piece of text.

and the configuration that I added to webpack.config.js is:

config.module.rules.push({
     test: /\.s[ac]ss$/,
     use: [
       // Creates `style` nodes from JS strings
       "style-loader",
       // Translates CSS into CommonJS
       {
         loader: 'css-loader',
         options : {
             modules : true,
             sourceMap : true,
             localIdentName : '[name]-[local]-[hash:base64:3]'
         }
       },
       // Compiles Sass to CSS
       "sass-loader",
     ],
 })

And the error I see in my browser console is:

/src/components/Redirecting/redirecting.scss (./node_modules/css-loader/dist/cjs.js??ref--8-1!./node_modules/sass-loader/dist/cjs.js!./src/components/Redirecting/redirecting.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: this.getOptions is not a function
    at Object.loader (/home/me/my-app-folder/node_modules/sass-loader/dist/index.js:27:24)

Note : Going to https://webpack.js.org/loaders/sass-loader/, node-sass was marked as depracted, so I used the updated library: dart sass, however, I already had tried with node-sass and saw the same error.
Using the configuration suggested in this address, nothing changed, since it's not that different either:

module.exports = {
  module: {
    rules: [
      {
        test: /\.s[ac]ss$/i,
        use: [
          // Creates `style` nodes from JS strings
          "style-loader",
          // Translates CSS into CommonJS
          "css-loader",
          // Compiles Sass to CSS
          "sass-loader",
        ],
      },
    ],
  },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔖 Ready for Development
Development

No branches or pull requests

2 participants