Vue Element UI installation error

Install Element-UI

npm and u-element and -S

execution error

 

ERROR in ./~/element-ui/lib/theme-default/index.css

Module parse failed: /Users/huzhixin/www/qnzsresearch/node_modules/element-ui/lib/theme-default/index.css Unexpected character '@' (1:0)

You may need an appropriate loader to handle this file type.

| @charset "UTF-8";.

 

The error is because we introduced the CSS file index.css, but it cannot be recognized and converted into js when webpack is packaged, so it needs to be configured to read the css and font files, run the command to install the following three things (if it has been installed before no need)

perform installation

npm install style-loader --save-dev

npm install css-loader --save-dev

npm install file-loader --save-dev

Modify webpack.config.js

 

     {
          test: /\.css$/,
          loader: "style-loader!css-loader",
          exclude: /node_modules/
      },
      {
          test: /\.(eot|woff|woff2|ttf)([\\?]?.*)$/,
          loader: "file-loader"
      },

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326151101&siteId=291194637