SoFunction
Updated on 2025-04-04

How to replace dart-sass in vue2 old projects

vue2 old project replaces dart-sass in node-sass

Reason for replacement: node-sass often has node version problems, which is very troublesome

Uninstall node-sass sass-loader in the project

npm uninstall sass-loader sass 

Install dart-sas sas-loader It is recommended to install [email protected][email protected]

From a new configuration

// 
 = {
  css: {
    loaderOptions: {
      sass: {
        implementation: require('sass'), // This line must in sass option
      },
    },
  }
}

Then you need to replace /deep/ globally and search/deep/, put the project in/deep/Replace with::v-deep

If stylelint is used, the configuration rules need to be modified

// 
	 = {
	  ...
	  rules: {
	    'selector-pseudo-element-no-unknown': [
	      true,
	      {
	        ignorePseudoElements: ['v-deep'],
	      },
	    ],
	  },
	  ...
	};

This is the article about how to replace dart-sass in vue2 old projects. For more related content on vue node-sass replacement dart-sass, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!