From 723a4f2847ca87672e5df7315a20ceaa298c0d50 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Thu, 10 Dec 2015 10:38:40 -0600 Subject: [PATCH] only create single CommonJS bundle --- gulpfile.js | 17 ++--------------- scripts/npm/bundle.webpack.config.js | 19 ------------------- scripts/npm/ionic.webpack.config.js | 26 +++++++++++++++++++++----- 3 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 scripts/npm/bundle.webpack.config.js diff --git a/gulpfile.js b/gulpfile.js index 59798dd9d1..551e39a522 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -203,22 +203,9 @@ gulp.task('bundle', ['transpile', 'copy.web-animations'], function(done){ // prepend.push('window.Element.prototype.animate=undefined;'); // } - var numTasks = 2; - var ionicConfig = require('./scripts/npm/ionic.webpack.config.js'); - var bundleConfig = require('./scripts/npm/bundle.webpack.config.js'); - - bundle(ionicConfig, finished); - bundle(bundleConfig, finished); - - function finished(){ - numTasks--; - if (numTasks == 0) done(); - } -}) - -function bundle(config, cb){ var webpack = require('webpack'); var path = require('path'); + var config = require('./scripts/npm/ionic.webpack.config.js'); webpack(config, function(err, stats){ var statsOptions = { @@ -231,7 +218,7 @@ function bundle(config, cb){ console.log(stats.toString(statsOptions)); cb(); }) -} +}) gulp.task('temp.hack', function(){ var fs = require('fs'); diff --git a/scripts/npm/bundle.webpack.config.js b/scripts/npm/bundle.webpack.config.js deleted file mode 100644 index c0a9a796d6..0000000000 --- a/scripts/npm/bundle.webpack.config.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - entry: [ - "zone.js", // required for Angular change detection - "reflect-metadata", // required for Angular DI - "es6-shim/es6-shim.min.js", - "web-animations.min", - "./dist/ionic.js" - ], - output: { - path: 'dist/bundles', - filename: 'ionic.bundle.js', - libraryTarget: 'umd' - }, - resolve: { - alias: { - 'web-animations.min': './dist/js/web-animations.min' - } - } -}; diff --git a/scripts/npm/ionic.webpack.config.js b/scripts/npm/ionic.webpack.config.js index faff392308..0a0b60a249 100644 --- a/scripts/npm/ionic.webpack.config.js +++ b/scripts/npm/ionic.webpack.config.js @@ -1,16 +1,32 @@ module.exports = { entry: [ - "es6-shim/es6-shim.min.js", "./dist/ionic.js" ], output: { path: 'dist/bundles', filename: 'ionic.js', - libraryTarget: 'umd' + libraryTarget: 'commonjs2' }, externals: [ - 'angular2/angular2', - 'angular2/router', - 'angular2/http' + { + 'angular2/core': { + commonjs2: ['angular2', 'core'] + }, + 'angular2/common': { + commonjs2: ['angular2', 'common'] + }, + 'angular2/router' : { + commonjs2: ['angular2', 'router'] + }, + 'angular2/http': { + commonjs2: ['angular2', 'http'] + }, + 'angular2/platform/browser': { + commonjs2: ['angular2', 'platform', 'browser'] + }, + 'angular2/instrumentation': { + commonjs2: ['angular2', 'instrumentation'] + }, + } ] };