const extractScssPlugin = require('./extract-scss.plugin');

module.exports = [
  // Lint source code.
  {
    enforce: 'pre',
    test: /\.js$/,
    exclude: /node_modules/,
    loader: 'eslint-loader',
  },
  // Allow ES6 in .js files.
  {
    test: /\.js$/,
    loader: 'babel-loader',
    exclude: /node_modules\/(?!(autonumeric)\/).*/,
  },
  // Lets you pull templates into the JS bundle by
  // simply importing them into your JS files.
  {
    test: /\.html$/,
    loader: 'html-loader',
  },
  // Lets you pull SCSS into the CSS bundle by
  // simply importing into your JS files. SCSS
  // will be transformed to CSS and autoprefixed
  // for you.
  {
    test: /\.scss$/,
    use: extractScssPlugin.extract({
      fallback: 'style-loader',
      use: ['css-loader', 'postcss-loader', 'sass-loader'],
    }),
  },
  // Inlines SVG files
  {
    test: /\.svg$/,
    loader: 'svg-inline-loader',
  },
];
