I am trying to compile my less into css, but having some troubles understanding what is wrong.
I am currently using webpack 4.1.1 .
I have the following webpack.config.js file:
//Modules
const path = require('path');
const webpack = require('webpack'); //to access built-in plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const extractLess = new ExtractTextPlugin({
filename: "[name].[contenthash].css",
disable: process.env.NODE_ENV === "development"
});
module.exports = {
entry: './src/assets/js/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
// webpack-dev-server config for refreshing and more
devServer: {
contentBase: './dist',
},
//In order to import a CSS file from within a JavaScript module
module: {
rules: [
{
test: /\.less$/,
issuer: /\.less$/,
include: [
path.resolve(__dirname, "less")
],
use: [
{loader: "style-loader"},
{loader: "css-loader"},
{loader: "less-loader"}
]
},
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader'
]
},
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
'file-loader'
]
}
]
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery'
}),
extractLess
]
};
The error I am getting is as follow:
Module parse failed: Unexpected character '@' (1:0) You may need an appropriate loader to handle this file type. | @icon-font-path: "~bootstrap3/fonts/"; | @import '~bootstrap3/less/bootstrap';
What am I doing wrong?