const ExtractTextPlugin = require("extract-text-webpack-plugin"); module.exports = function (theme) { return { rules: [{ test: /\.js$/, exclude: /node_modules/, use: { loader: 'babel-loader', options: { "presets": ["es2015"] } } }, { test: /\.(css|less)$/, use: ExtractTextPlugin.extract({ fallback: 'style-loader', use: [{ loader: 'css-loader', options: { importLoaders: 1 } }, { loader: 'less-loader', options: { modifyVars: theme } }] }) }, { test: /\.html$/, use: [{ loader: 'html-withimg-loader', options: { minimize: false } }], }, { test: /\.(png|jpg|gif)$/, use: [{ loader: 'url-loader', options: { limit: 1, name: '[path][name].[ext]' } }] }, { test: /\.(woff|woff2|svg|eot|ttf)$/, use: [{ loader: 'url-loader', options: { limit: 1, name: '[path][name].[ext]' } }] }] }; }