Both docs and behavior for webpack.LoaderOptionsPlugin are wrong

bug

What is the current behavior?
webpack.LoaderOptionsPlugin doesn’t pass options to sass-loader
While in need for customised sass loadpath and separate css fiile output I’ve spent some time configuring bleeding edge Webpack 2 with bleeding edge sass-loader (:
Good news is that old-school approach works:
If the current behavior is a bug, please provide the steps to reproduce.

// this passing nothing
new webpack.LoaderOptionsPlugin({
      sassLoader: {
        includePaths: [
          path.resolve('./node_modules')
        ]
      }
    })

// this passing undefined
new webpack.LoaderOptionsPlugin({
  options: {
    sassLoader: {
      includePaths: [
        path.resolve('./node_modules')
      ]
    }
  }
})

What is the expected behavior?
sass-loader to use value of includePaths:

{
        test: /\.(sass|scss)$/,
        loader: ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: [
            'css-loader',
            'resolve-url-loader',
            {
              loader: 'sass-loader',
              query: {
                sourceMap: true,
                includePaths: [path.resolve('./node_modules')]
              }
            }
          ]
        }),
      }

Webpack 2.2.0-rc.3

Author: Fantashit

1 thought on “Both docs and behavior for webpack.LoaderOptionsPlugin are wrong

  1. Yes, after debugging breakpoint inside LoaderOptionsPlugin, finally find out the current behavior(webpack2 version) will wipe out the original context’s options, then, it breaks down a bunch of loaders acquiring some data from the original options property of loaderContext. like css-loader.

    I think this is a severe bug.

Comments are closed.