From 7feafc7c3cc50d70484ca729fd0a79938637b0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Farkas=20J=C3=B3zsef?= Date: Fri, 23 Dec 2016 19:57:00 +0100 Subject: [PATCH] Create polyfills and vendor chunks in a proper way --- src/index.html | 2 +- src/polyfills.ts | 2 ++ src/vendor.ts | 19 +++++++++++++++++++ src/webpack.config.js | 9 ++++++--- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/polyfills.ts create mode 100644 src/vendor.ts diff --git a/src/index.html b/src/index.html index 06717f76..265a9d2e 100644 --- a/src/index.html +++ b/src/index.html @@ -6,7 +6,7 @@ - + diff --git a/src/polyfills.ts b/src/polyfills.ts new file mode 100644 index 00000000..a386ad53 --- /dev/null +++ b/src/polyfills.ts @@ -0,0 +1,2 @@ +import 'core-js/es7/reflect'; +import 'zone.js/dist/zone'; diff --git a/src/vendor.ts b/src/vendor.ts new file mode 100644 index 00000000..4e6cc563 --- /dev/null +++ b/src/vendor.ts @@ -0,0 +1,19 @@ +import '@angular/platform-browser'; +import '@angular/platform-browser-dynamic'; +import '@angular/core'; +import '@angular/common'; +import '@angular/forms'; +import '@angular/router'; + +import 'rxjs'; + +import '@ngrx/core'; +import '@ngrx/effects'; +import '@ngrx/store'; + +import 'jquery'; +import 'bootstrap'; +import 'select2'; +import 'ng2-select2'; +import 'dragula'; +import 'ng2-dragula'; diff --git a/src/webpack.config.js b/src/webpack.config.js index 67a9372d..76ae7ac8 100644 --- a/src/webpack.config.js +++ b/src/webpack.config.js @@ -9,8 +9,9 @@ var rootDir = path.resolve(__dirname, '../'); module.exports = { entry: { - app: ['core-js', 'zone.js', './src/main.ts'], - vendor: ['jquery', 'bootstrap', 'select2'] + polyfills: './src/polyfills.ts', + vendor: './src/vendor.ts', + app: './src/main.ts' }, output: { path: rootDir + "/dist", @@ -76,7 +77,9 @@ module.exports = { $: "jquery", jQuery: "jquery" }), - new CommonsChunkPlugin("commons.chunk.js") + new CommonsChunkPlugin({ + name: ['app', 'vendor', 'polyfills'] + }) ] }