No file was generated using extract-text-webpack-plugin@4.0.0-beta.0 in webpack4

webpack4 uses extract-text-webpack-plugin@4.0.0-beta.0 for style file extraction but does not generate a file. After installing extract-text-webpack-plugin@4.0.0-beta.0, it is found that it can be compiled successfully, but no css file is generated
configuration file is as follows:

const ExtractTextPlugin=require("extract-text-webpack-plugin");
const config={
    entry:{
        app:__dirname+"/src/app.js",
        main:__dirname+"/src/index.js"
    },
    output:{
        filename:"[name]-[hash].js",
        path:__dirname+"/dist"
    },
    mode:"development",
    devtool:"source-map",//source map
    devServer:{//webpack
        contentBase:"./dist",//webpack-dev-server
        port:"8383",//
        inline:true,//true
        historyApiFallback:true,//HTML5 history APItrueindex.html
        hot:true//
    },
     module:{
      rules:[
          {
            test:/\.css$/,
            use:[
               {loader:"style-loader"},
               {loader:"css-loader",
                options:{
                  modules:true, //css modules
                  localIdentName:"[name]__[local]--[hash:base64:5]"// css
                }
               },
               {loader:"postcss-loader"}
            ]
          },
          {
            test:/\.less$/,
             use:ExtractTextPlugin.extract({ //lesscss
                fallback:"style-loader",
                use:["css-loader","less-loader"]
            })
          },
          {
            test:/\.js$/,
            use:{
              loader:"babel-loader",
              options:{
                presets:["env"]
              }
            },
            exclude:/node_modules/
          },
          {
            test:/\.vue$/,
            use:{
              loader:"vue-loader"
            }
          }
      ]
    },
    resolve: {
          alias: {
               "vue": "vue/dist/vue.js"
                 }
    },
     plugins: [
     new ExtractTextPlugin("css/index.css")
  ]
};

module.exports=config;

how is it that there is no corresponding index.css generation after executing the webpack command?

Apr.02,2021

because you didn't do a fallback after css-loader, you can refer to it here.

here is an example of getting started with webpack4. You can take a look at https://github.com/crlang/eas..


plugins:[
        new ExtractTextPlugin({
            filename:`[name]_[id]_[hash:8].css`,
        })
    ]

configure the short code in it

Less files introduced with import in

js are packaged.


webpack4 packages css using mini-css-extract-plugin, that plug-in is abandoned


how to solve it? I also encountered this problem


Wow, nauseous to vomit, I also encountered the same problem. Like a fan, I can't pack anything.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e93835-145d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e93835-145d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?