diff --git a/etc/appConfig.js b/etc/appConfig.js index e351c18..7eaac1c 100644 --- a/etc/appConfig.js +++ b/etc/appConfig.js @@ -24,7 +24,8 @@ var appConfig = { srcIMG: path.resolve(sourceRoot, 'img'), index: path.resolve(sourceRoot, 'index.html'), dist: distRoot, - distPath: distPath + distPath: distPath, + additionalWebpackOptions: false }; module.exports = appConfig; diff --git a/etc/karma.conf.ci.js b/etc/karma.conf.ci.js index 72cd2d2..4eeb4cd 100644 --- a/etc/karma.conf.ci.js +++ b/etc/karma.conf.ci.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ const baseConfig = require('./karma.conf.js'); const defaultAppConfig = require('./appConfig'); diff --git a/etc/karma.conf.js b/etc/karma.conf.js index c0b3e33..705b15a 100755 --- a/etc/karma.conf.js +++ b/etc/karma.conf.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ const defaultAppConfig = require('./appConfig'); const appConfig = require(process.env.APP_CONFIG || './appConfig'); diff --git a/etc/protractor.conf.js b/etc/protractor.conf.js index 91e3368..5a740d2 100755 --- a/etc/protractor.conf.js +++ b/etc/protractor.conf.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ require('ts-node/register'); diff --git a/etc/webpack.common.js b/etc/webpack.common.js index eb8b74f..7cc8caf 100755 --- a/etc/webpack.common.js +++ b/etc/webpack.common.js @@ -2,6 +2,7 @@ const webpack = require('webpack'); const path = require('path'); const helpers = require('./helpers'); const appConfig = require(process.env.APP_CONFIG || './appConfig'); +const debugLog = util.debuglog('@holisticon/angular-common/webpack.common'); /* * Webpack Plugins @@ -12,6 +13,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin'); const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin; const HtmlElementsPlugin = require('./html-elements-plugin'); +debugLog('Using following appConfig:', appConfig); /* * Webpack Constants */ @@ -26,7 +28,7 @@ const METADATA = { * * See: http://webpack.github.io/docs/configuration.html#cli */ -module.exports = { +var config = { /* * Static metadata for index.html @@ -289,3 +291,11 @@ module.exports = { } }; + + +// add additional settings here +if (appConfig.additionalWebpackOptions) { + config = webpackMerge(config, appConfig.additionalWebpackOptions); +} +debugLog('Using following webpack common config:', config); +module.exports = config; diff --git a/etc/webpack.dev.js b/etc/webpack.dev.js index ac9e20c..2bbf0ba 100755 --- a/etc/webpack.dev.js +++ b/etc/webpack.dev.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ const appConfig = require(process.env.APP_CONFIG || './appConfig'); @@ -11,6 +11,7 @@ const commonConfig = require('./webpack.common.js'); // the settings that are co * Webpack Plugins */ const DefinePlugin = require('webpack/lib/DefinePlugin'); +const VisualizerPlugin = require('webpack-visualizer-plugin'); /** * Webpack Constants @@ -91,7 +92,7 @@ module.exports = webpackMerge(commonConfig, { chunkFilename: '[id].chunk.js', library: 'ac_[name]', - libraryTarget: 'var', + libraryTarget: 'var' }, plugins: [ @@ -115,6 +116,10 @@ module.exports = webpackMerge(commonConfig, { 'HMR': METADATA.HMR, } }), + // see https://github.com/chrisbateman/webpack-visualizer#plugin-usage + new VisualizerPlugin({ + filename: './statistics.html' + }) ], /** diff --git a/etc/webpack.prod.js b/etc/webpack.prod.js index 1b06a98..bba9337 100755 --- a/etc/webpack.prod.js +++ b/etc/webpack.prod.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ const appConfig = require(process.env.APP_CONFIG || './appConfig'); diff --git a/etc/webpack.test.js b/etc/webpack.test.js index 0cc8203..f1a750c 100755 --- a/etc/webpack.test.js +++ b/etc/webpack.test.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ const appConfig = require(process.env.APP_CONFIG || './appConfig'); diff --git a/karma.conf.ci.js b/karma.conf.ci.js index 92187d6..febf1cc 100644 --- a/karma.conf.ci.js +++ b/karma.conf.ci.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ // Look in ./config for karma.conf.js diff --git a/karma.conf.js b/karma.conf.js index efe383e..d691223 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ // Look in ./config for karma.conf.js diff --git a/package.json b/package.json index 7664834..c4be757 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,8 @@ "webpack": "2.1.0-beta.22", "webpack-dev-server": "2.1.0-beta.2", "webpack-md5-hash": "0.0.5", - "webpack-merge": "0.14.1" + "webpack-merge": "0.14.1", + "webpack-visualizer-plugin": "^0.1.5" }, "devDependencies": { "@angular/common": "2.0.2", diff --git a/webpack.config.js b/webpack.config.js index 3fee5bf..ad00c3a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,5 @@ /** - * @author: @martinreinhardt + * @author: hypery2k */ // Look in ./config folder for webpack.dev.js