const webpack = require('webpack') const path = require('path') const autoprefixer = require('autoprefixer') const extractTextPlugin = require('extract-text-webpack-plugin') const uglifyJsPlugin = require('uglifyjs-webpack-plugin') const entryFile = path.resolve(__dirname, 'src/index.js') const inputPath = path.resolve(__dirname, 'src/') const outputPath = path.resolve(__dirname, 'static/') module.exports = { entry: entryFile, output: { path: outputPath, filename: 'app.js' }, plugins: [ new webpack.NoEmitOnErrorsPlugin(), new extractTextPlugin({ filename: 'app.css', allChunks: true }), new uglifyJsPlugin() ], module: { rules: [ { test: /\.(js|jsx)$/, exclude: /(node_modules|bower_modules)/, include: inputPath, loader: 'babel-loader' }, { test: /\.less$/, use: extractTextPlugin.extract({ fallback: 'style-loader', use: [ { loader: 'css-loader', options: { minimize: true } }, { loader: 'less-loader' } ] }) }, { test: /\.(ttf|eot|svg|woff|woff2)(\?.+)?$/, loader: 'file-loader?name=[hash:12].[ext]' } ] } }