I
I
Ihimura2017-02-04 16:01:10
Less
Ihimura, 2017-02-04 16:01:10

Why doesn't less-loader see @import?

Webpack 2.x when building in less files throws an error on the line with '@import "./filename.less"'. Moreover, all other less goodies (variables, functions, etc.) work fine.
In webpack version 1.x, I did not encounter such a problem, everything worked fine.
config for webpack:

var path = require('path');

module.exports = {
   entry: './client/index.js',
   output: {
      path: path.join(__dirname, '/public/build'),
      filename: 'bundle.js',
      publicPath: '/build/'
   },
   module: {
      rules: [
         {
            test: /\.jsx?$/,
            exclude: /node_modules/,
            loader: 'babel-loader'
         },
         {
            test: /\.less$/,
            exclude: [/node_modules/],
            use: ['style-loader', 'css-loader', 'autoprefixer-loader', 'less-loader']
         }
      ]
   }
};

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question