Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Not possible to use with the new use syntax #275

Closed
bebraw opened this issue Oct 28, 2016 · 2 comments
Closed

Not possible to use with the new use syntax #275

bebraw opened this issue Oct 28, 2016 · 2 comments

Comments

@bebraw
Copy link
Contributor

bebraw commented Oct 28, 2016

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.

@renarsvilnis
Copy link
Contributor

Related #265

@bebraw
Copy link
Contributor Author

bebraw commented Nov 1, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants