WEBPACK 4 help for less configuration

谁说我不能喝 提交于 2019-12-12 18:36:53

问题


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 !

来源:https://stackoverflow.com/questions/50326241/webpack-4-help-for-less-configuration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!