'use strict'; let webpack = require("webpack"); process.env.NODE_ENV = 'production'; let isProd = (process.env.NODE_ENV === 'production'); /** * Conditionally return a list of plugins to use based on the current environment. * Repeat this pattern for any other config key (ie: loaders, etc). * @returns {Array} */ function getPlugins() { let plugins = []; /** * Always expose NODE_ENV to webpack, you can now use `process.env.NODE_ENV` * inside your code for any environment checks; UglifyJS will automatically * drop any unreachable code. */ plugins.push(new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify(process.env.NODE_ENV) } })); /** Conditionally add plugins for Production builds. */ if (isProd) { plugins.push(new webpack.optimize.UglifyJsPlugin()); } else { /** Conditionally add plugins for Development */ } return plugins; } const config = { module: {} }; let mineSeekerConfig = Object.assign({}, config, { entry: './web/bundles/mineseeker/js/mine-seeker.js', output: { path: './src/Mine/SeekerBundle/Resources/public/js/build/mine-seeker/', filename: 'index.min.js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015', 'react'] } } ] } }); let mineUserListConfig = Object.assign({}, config, { entry: './web/bundles/mineseeker/js/mine-user-list.js', output: { path: './src/Mine/SeekerBundle/Resources/public/js/build/mine-user-list/', filename: 'index.min.js' }, module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015', 'react'] } } ] } }); module.exports = [ mineSeekerConfig, mineUserListConfig, ];