In the Webpack environment, loading CSS requires Css-loader and Style-loader.
Css-loader: use similar @import and URLs (...) method to realize the function of require;
Style-loader: Add all the calculated styles to the page.
But if you need to use SASS/SCSS to define the style, then in order to compile properly, you also need to do the following configuration:
// under Project, run the following command line npm install--save-dev sass-loader// because Sass-loader relies on node-sass, So also install Node-sass NPM installed--save-dev node-sass
When installing Node-sass using the method above, an error occurs as follows:
If you have a mistake like this, try using Taobao's image:
NPM Install--save node-sass--registry=https://registry.npm.taobao.org--disturl=https:// Npm.taobao.org/dist --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
Troubleshoot errors that occur when you install SASS Webpack