3

I am trying to understand some trick with webpack. I explain.

What i have ? My archi is like :

www

- css/
     - folder/
      - some.src.less
      - other.less
     - cssOther/
      - t.src.less
           - subFolder/
              - t.less

My archi is like this. What i want to do is to just compile *.src.less and send them to dist and keep their path and name folder.

My actual webpack config.

First is it obligatoy needed to use a .js entry ? (i dont need it actually)

I am working on it if I found something interesting i will update here

const path = require('path')
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  mode: 'development',
  entry: './webpack.js',
  output: {
      path: path.resolve(__dirname, 'dist'),
      filename: 'webpack.js'
  },
  module: {
    rules: [
      {
        test: /\.less$/,
        use: [
            MiniCssExtractPlugin.loader,
            "css-loader",
            "less-loader"
        ]
      }
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      // Options similar to the same options in webpackOptions.output
      // both options are optional
      filename: "[name].css",
      chunkFilename: "[id].css"
    })
  ]
}

Thanks for answears !

Venki WAR
  • 1,997
  • 4
  • 25
  • 38
Florent Giraud
  • 185
  • 1
  • 10

0 Answers0