var webpack = require('webpack'); var path = require('path'); var ExtractTextPlugin = require('extract-text-webpack-plugin'); var HtmlWebpackPlugin = require('html-webpack-plugin'); var FaviconsWebpackPlugin = require('favicons-webpack-plugin'); var TranslationPlugin = require('extract-translation-keys-webpack'); module.exports = { entry: [ './src/index.js' ], devtool: 'source-map', output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js' }, resolve: { extensions: ['', '.js', '.jsx'], alias: { 'react': 'preact-compat', 'react-dom': 'preact-compat', 'flags.css' : path.join(__dirname, 'node_modules/flag-icon-css/css/flag-icon.min.css') } }, module: { loaders: [{ test: /\.jsx?$/, exclude: /(node_modules)/, loaders: ['babel', TranslationPlugin.loader({ path :path.join(__dirname, "config/locales/generated") })] }, { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, { test: /\.scss$/, loaders: ['style', 'css', 'autoprefixer?browsers=last 2 versions', "sass?outputStyle=expanded&" ] },{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" }, { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" }, { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" }, { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }, { test: /\.gif/, loader: "url-loader?limit=10000&mimetype=image/gif" }, { test: /\.jpg/, loader: "url-loader?limit=10000&mimetype=image/jpg" }, { test: /\.png/, loader: "url-loader?limit=10000&mimetype=image/png" },{ test : /\.json/, loader: "json-loader" } ] }, plugins: [ new ExtractTextPlugin('bundle.css'), new HtmlWebpackPlugin({ title : 'Rate-It', template : './template/index.ejs', inject: false }), new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false }, comments: false, minimize: false, sourceMap : true }), new webpack.optimize.AggressiveMergingPlugin(), new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }), new FaviconsWebpackPlugin('./images/favicon.png'), new TranslationPlugin({ path : path.join(__dirname, "config/locales/generated"), output : path.join(__dirname, "config/locales"), lang : "en" }) ] };