Search code examples
webpack-2webpack-style-loader

how to read webpack's ExtractTextPlugin.extract use property?


In my webpack config file I have this line which I can't understand what it means and how to understand or debug it.

{
        test: /\.(scss|css)$/,
        use: isProd
          ? ExtractTextPlugin.extract({
              use: 'css-loader!sass-loader?minimize',
              fallback: 'vue-style-loader',
            })
          : ['vue-style-loader', 'css-loader', 'sass-loader'],
 },

In this the line use: 'css-loader!sass-loader?minimize' What does ! and ? mean here. I have read similar syntax but unable to recognize it. Can you tell me what it means and some links where I can read in depth about it?


Solution

  • ! is separate between loaders. ? is definition options for before loader.

    You can read more in https://webpack.js.org/concepts/loaders/#inline

    And it's deprecated feature from webpack 1: https://webpack.js.org/guides/migrating/#chaining-loaders