New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to use with the new `use` syntax #275

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

Comments

Projects
None yet
2 participants
@bebraw
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

This comment has been minimized.

Show comment
Hide comment
@renarsvilnis

renarsvilnis Nov 1, 2016

Contributor

Related #265

Contributor

renarsvilnis commented Nov 1, 2016

Related #265

@bebraw

This comment has been minimized.

Show comment
Hide comment
@bebraw

bebraw Nov 1, 2016

Contributor

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

Contributor

bebraw commented Nov 1, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment