diff --git a/package.json b/package.json index 48846c4ce54be0af5e7bfc56178384da72ced9d3..0c773c956a99b0a7a7c339c2754925e4fa7be31d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "babel-loader": "^6.2.5", "babel-preset-es2015": "^6.16.0", "babel-preset-stage-1": "^6.16.0", - "react": "^15.3.2", + "compression-webpack-plugin": "^0.3.2", + "react": "^15.4.0", "react-hot-loader": "^3.0.0-beta.5", "webpack": "^1.13.2", "webpack-bundle-tracker": "0.0.93", @@ -26,10 +27,10 @@ "axios": "^0.14.0", "babel-core": "^6.17.0", "babel-preset-react": "^6.16.0", - "material-ui": "^0.16.0", "react-dom": "^15.3.2", "react-router": "^3.0.2", "react-tap-event-plugin": "^2.0.1", + "semantic-ui-css": "^2.2.9", "semantic-ui-react": "^0.65.0" } } diff --git a/webpack.config.js b/webpack.config.js index 682a34d7a27c51455c508ca4d94deb8a69822cad..d1f490903d71d490ef8341abf953949462e79469 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,34 +14,7 @@ module.exports = { plugins: [ new webpack.HotModuleReplacementPlugin(), - new BundleTracker({filename: './webpack-stats.json'}), - - // removes a lot of debugging code in React - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - }}), - - // keeps hashes consistent between compilations - new webpack.optimize.AggressiveMergingPlugin(), - new webpack.optimize.OccurrenceOrderPlugin(), - new webpack.optimize.DedupePlugin(), - new webpack.optimize.UglifyJsPlugin({ - mangle: true, - compress: { - warnings: false, // Suppress uglification warnings - pure_getters: true, - unsafe: true, - unsafe_comps: true, - screw_ie8: true - }, - output: { - comments: false, - }, - exclude: [/\.min\.js$/gi] // skip pre-minified libs - }), - - new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]) + new BundleTracker({filename: './webpack-stats.json'}) ], module: { diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 68d5c0c5e456ff9f49485f6c2769801c59798a4a..8a93d5f5ebd673b4100ba95946f7bec66f8cba71 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -1,33 +1,73 @@ +var path = require("path") var webpack = require('webpack') var BundleTracker = require('webpack-bundle-tracker') +var CompressionPlugin = require('compression-webpack-plugin') -var config = require('./webpack.base.config.js') +module.exports = { + context: __dirname, -config.output.path = require('path').resolve('./assets/dist') + entry: './assets/js/index', // entry point of our app. assets/js/index.js should require other js modules and dependencies it needs -config.plugins = config.plugins.concat([ - new BundleTracker({filename: './webpack-stats-prod.json'}), + output: { + path: path.resolve('./assets/bundles/'), + filename: "[name]-[hash].js", + }, - // removes a lot of debugging code in React - new webpack.DefinePlugin({ - 'process.env': { - 'NODE_ENV': JSON.stringify('production') - }}), + plugins: [ + new webpack.HotModuleReplacementPlugin(), + new BundleTracker({filename: './webpack-stats.json'}), - // keeps hashes consistent between compilations - new webpack.optimize.OccurenceOrderPlugin(), + // removes a lot of debugging code in React + new webpack.DefinePlugin({ + 'process.env': { + 'NODE_ENV': JSON.stringify('production') + }}), - // minifies your code - new webpack.optimize.UglifyJsPlugin({ - compressor: { - warnings: false - } - }) -]) + // keeps hashes consistent between compilations + new webpack.optimize.AggressiveMergingPlugin(), + new webpack.optimize.OccurrenceOrderPlugin(), + new webpack.optimize.DedupePlugin(), + new webpack.optimize.UglifyJsPlugin({ + mangle: true, + compress: { + warnings: false, // Suppress uglification warnings + pure_getters: true, + unsafe: true, + unsafe_comps: true, + screw_ie8: true + }, + output: { + comments: false, + }, + exclude: [/\.min\.js$/gi] // skip pre-minified libs + }), -// Add a loader for JSX files -config.module.loaders.push( - { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel' } -) + new webpack.IgnorePlugin(/^\.\/locale$/, [/moment$/]), -module.exports = config + new CompressionPlugin({ + asset: "[path][query]", + algorithm: "gzip", + test: /\.js$|\.css$|\.html$/, + threshold: 10240, + minRatio: 0.8 + }) + ], + + module: { + loaders: [ + { test: /\.jsx?$/, + exclude: /node_modules/, + loader: 'babel-loader', // to transform JSX into JS + query: + { + presets:['react', 'es2015', 'stage-1'] + } + } + ], + }, + + resolve: { + modulesDirectories: ['node_modules', 'bower_components'], + extensions: ['', '.js', '.jsx'] + }, +}