Skip to content

Commit

Permalink
Merge pull request #81 from mircobe87/issue-68-cleanup
Browse files Browse the repository at this point in the history
Fixes #68, reduces bundle size to deploy
  • Loading branch information
mbarto committed Aug 28, 2015
2 parents e07fa7d + cd5c75c commit bc13671
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
},
"scripts": {
"clean": "rm -Rf ./web/client/dist",
"compile": "npm run clean && mkdirp ./web/client/dist && webpack",
"compile": "npm run clean && mkdirp ./web/client/dist && webpack --config prod-webpack.config.js",
"start": "webpack-dev-server --progress --colors --port 8081 --content-base web/client",
"test": "karma start ./karma.conf.single-run.js",
"continuoustest": "karma start ./karma.conf.continuous-test.js",
Expand Down
13 changes: 13 additions & 0 deletions prod-webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var webpackConfig = require('./webpack.config.js');
var UglifyJsPlugin = require("webpack/lib/optimize/UglifyJsPlugin");

webpackConfig.plugins.push(
new UglifyJsPlugin({
compress: {warnings: false},
mangle: true
})
);
webpackConfig.devtool = undefined;
webpackConfig.debug = false;

module.exports = webpackConfig;
11 changes: 1 addition & 10 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var path = require("path");
var CommonsChunkPlugin = require("webpack/lib/optimize/CommonsChunkPlugin");
var UglifyJsPlugin = require("webpack/lib/optimize/UglifyJsPlugin");
var rewriteUrl = function(replacePath) {
return function(req, opt) { // gets called with request and proxy object
var queryIndex = req.url.indexOf('?');
Expand All @@ -9,8 +8,6 @@ var rewriteUrl = function(replacePath) {
};
};

var PROD = JSON.parse(process.env.PROD_DEV || "0");

module.exports = {
entry: {
viewer: path.join(__dirname, "web", "client", "examples", "viewer", "app"),
Expand All @@ -21,13 +18,7 @@ module.exports = {
publicPath: "/dist/",
filename: "[name].js"
},
plugins: PROD ? [
new CommonsChunkPlugin("commons", "mapstore-commons.js"),
new UglifyJsPlugin({
compress: {warnings: false},
mangle: true
})
] : [
plugins: [
new CommonsChunkPlugin("commons", "mapstore-commons.js")
],
resolve: {
Expand Down

0 comments on commit bc13671

Please sign in to comment.