Why replace?
How to replace:
1: uninstall the node – sass
// First method: delete node-sass from package.json. It is recommended to uninstall the installation dependency again after uninstallation. Second method: NPM uninstall node-sass yarn remove node-sassCopy the code
2: install the dart – sass
// npm
npm install --dev sass
// yarn
yarn add sass --dev
Copy the code
3: Configure the vue.config.js file
Module.exports = {CSS: {loaderOptions: {sass: {implementation:}} module.exports = {CSS: {loaderOptions: {sass: {implementation:}} require('sass'), // This line must in sass option }, }, } }Copy the code
4: Global search (/deep/ and >>>) is replaced with ::v-deep
Note:
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Cannot find module 'node-sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.sassLoader (/path-of-your-project-directory/node_modules/sass-loader/lib/loader.js:24:22
Copy the code
module.exports = {
rules: {
'selector-pseudo-element-no-unknown': [ true,
{
ignorePseudoElements: ['v-deep'],
}
],
},
Copy the code