@@ -11,11 +11,13 @@ const helpers = require('./helpers');
1111// problem with copy-webpack-plugin
1212const AssetsPlugin = require ( 'assets-webpack-plugin' ) ;
1313const ContextReplacementPlugin = require ( 'webpack/lib/ContextReplacementPlugin' ) ;
14+ const CommonsChunkPlugin = require ( 'webpack/lib/optimize/CommonsChunkPlugin' ) ;
1415const CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ;
1516const ForkCheckerPlugin = require ( 'awesome-typescript-loader' ) . ForkCheckerPlugin ;
1617const HtmlElementsPlugin = require ( './html-elements-plugin' ) ;
1718const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
1819const LoaderOptionsPlugin = require ( 'webpack/lib/LoaderOptionsPlugin' ) ;
20+ const ScriptExtHtmlWebpackPlugin = require ( 'script-ext-html-webpack-plugin' ) ;
1921
2022/*
2123 * Webpack Constants
@@ -173,7 +175,7 @@ module.exports = function (options) {
173175 * See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
174176 * See: https://github.com/webpack/docs/wiki/optimization#multi-page-app
175177 */
176- new webpack . optimize . CommonsChunkPlugin ( {
178+ new CommonsChunkPlugin ( {
177179 name : [ 'polyfills' , 'vendor' ] . reverse ( )
178180 } ) ,
179181
@@ -198,15 +200,12 @@ module.exports = function (options) {
198200 *
199201 * See: https://www.npmjs.com/package/copy-webpack-plugin
200202 */
201- new CopyWebpackPlugin ( [
202- {
203- from : 'src/assets' ,
204- to : 'assets' ,
205- } ,
206- {
207- from : 'src/meta' ,
208- } ,
209- ] ) ,
203+ new CopyWebpackPlugin ( [ {
204+ from : 'src/assets' ,
205+ to : 'assets' ,
206+ } , {
207+ from : 'src/meta' ,
208+ } , ] ) ,
210209
211210
212211 /*
@@ -221,7 +220,19 @@ module.exports = function (options) {
221220 template : 'src/index.html' ,
222221 title : METADATA . title ,
223222 chunksSortMode : 'dependency' ,
224- metadata : METADATA
223+ metadata : METADATA ,
224+ inject : 'head'
225+ } ) ,
226+
227+ /*
228+ * Plugin: ScriptExtHtmlWebpackPlugin
229+ * Description: Enhances html-webpack-plugin functionality
230+ * with different deployment options for your scripts including:
231+ *
232+ * See: https://github.com/numical/script-ext-html-webpack-plugin
233+ */
234+ new ScriptExtHtmlWebpackPlugin ( {
235+ defaultAttribute : 'defer'
225236 } ) ,
226237
227238 /*
0 commit comments