const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');

module.exports.bundle = function(testPath, outputPath) {
  return {
    entry: './test/screenshot/' + testPath,
    output: {
      filename: outputPath + '.js',
    },
    module: {
      rules: [{
        test: /\.js$/,
        loader: 'babel-loader',
        query: {compact: true},
      }, {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          use: [
            {
              loader: 'css-loader',
            },
            {
              loader: 'sass-loader',
              options: {
                importer: function(url, prev) {
                  if (url.indexOf('@material') === 0) {
                    let filePath = url.split('@material')[1];
                    let nodeModulePath = `./node_modules/@material/${filePath}`;
                    return {
                      file: require('path').resolve(nodeModulePath),
                    };
                  }
                  return {
                    file: url,
                  };
                },
              },
            },
          ],
        }),
      }],
    },
    plugins: [
      new ExtractTextPlugin(outputPath + '.css'),
      new OptimizeCssAssetsPlugin(),
    ],
  };
};

@@ -681,475 +681,39 @@
    i
-mporter: function(url, prev) %7B%0A                  if (url.indexOf('@material') === 0) %7B%0A                    let filePath = url.split('@material')%5B1%5D;%0A                    let nodeModulePath = %60./node_modules/@material/$%7BfilePath%7D%60;%0A                    return %7B%0A                      file: require('path').resolve(nodeModulePath),%0A                    %7D;%0A                  %7D%0A                  return %7B%0A                    file: url,%0A                  %7D;%0A                %7D
+ncludePaths: %5B'./node_modules'%5D
 ,%0A  

Use `includePaths` instead of `importer` in `sass-loader` config (#15)