1. 安装:
npm  install  style-loader  css-loader  less-loader  less
  1. 配置:
const path = require('path');
module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(__dirname)
  },
  module: {
    rules: [
      {
        test: /\.(less|css)$/,
        use: [
          'style-loader',
          'css-loader',
          'less-loader'
        ]
      }
    ]
  }
};

(注意:顺序不能弄反) 3. 使用:

import less from './static/less/test.less';
console.log(less)