const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

module.exports = function (env) {
  return {
    development: [
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader',
        ],
      },
      {
        test: /\.scss$/,
        use: [
          'style-loader',
          {
            loader: 'css-loader',
            options: {
              module: true,
              importLoaders: 1,
              sourceMap: true,
              localIdentName: '[name]__[local]___[hash:base64:5]',
            },
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: true,
              includePaths: [
                path.join(process.cwd(), '.core/app/styles'),
                path.join(process.cwd(), 'src/app/styles')
              ],
            },
          },
        ],
      }
    ],
    production: [
      {
        test: /\.css$/,
        exclude: /node_modules/,
        loader: ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: 'css-loader',
        }),
      },
      {
        test: /\.scss$/,
        exclude: /node_modules/,
        loader: ExtractTextPlugin.extract({
          fallbackLoader: 'style-loader',
          loader: [
            {
              loader: 'css-loader',
              query: {
                modules: true,
                importLoaders: 2,
                localIdentName: '[name]__[local]___[hash:base64:5]',
                minimize: true,
              },
            },
            'postcss-loader',
            {
              loader: 'sass-loader',
              query: {
                includePaths: [path.join(process.cwd(), 'src/app/styles')],
              },
            },
          ],
        }),
      }
    ]
  }[env || 'development']
}

@@ -1723,16 +1723,99 @@
 Paths: %5B
+%0A                  path.join(process.cwd(), '.core/app/styles'),%0A                  
 path.joi
@@ -1848,16 +1848,33 @@
 styles')
+%0A                
 %5D,%0A     

add sass loader include path for production