webpack-contrib/extract-text-webpack-plugin

Not possible to use with the new `use` syntax

bebraw opened this issue · 2 comments

The following snippet works:

exports.extractCSS = function(paths) {
  return {
    module: {
      rules: [
        // Extract CSS during build
        {
          test: /\.css$/,
          loader: ExtractTextPlugin.extract({
            fallbackLoader: 'style-loader',
            loader: 'css-loader'
          }),
          include: paths
        }
      ]
    },
    plugins: [
      // Output extracted CSS to a file
      new ExtractTextPlugin('[name].[chunkhash].css')
    ]
  };
}

If it's upgraded to use like this it fails:

exports.extractCSS = function(paths) {
  return {
    module: {
      rules: [
        // Extract CSS during build
        {
          test: /\.css$/,
          use: ExtractTextPlugin.extract({
            fallbackLoader: 'style-loader',
            loader: 'css-loader'
          }),
          include: paths
        }
      ]
    },
    plugins: [
      // Output extracted CSS to a file
      new ExtractTextPlugin('[name].[chunkhash].css')
    ]
  };
}

I also tried wrapping ExtractTextPlugin.extract to an array with the same result. Given loader is getting deprecated, ExtractTextPlugin should probably work with use. Interestingly the README suggests using loader instead.

Related #265

Ok, I'm closing this in favor of that then.