File tree Expand file tree Collapse file tree 1 file changed +10
-17
lines changed
Expand file tree Collapse file tree 1 file changed +10
-17
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ var HtmlWebpackPlugin = require('html-webpack-plugin');
66var ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ;
77var CommonsChunkPlugin = require ( 'webpack/lib/optimize/CommonsChunkPlugin' ) ;
88
9- var entries = getEntry ( ) ;
10- var chunks = getChunkName ( ) ;
9+ var entries = { } ;
10+ var chunks = [ ] ;
11+ getEntriesAndChunks ( ) ;
1112
1213var config = {
1314 entry : entries ,
@@ -101,29 +102,21 @@ pages.forEach(function (pathname) {
101102
102103module . exports = config ;
103104
104- function getEntry ( ) {
105- var entry = { } ;
105+ function getEntriesAndChunks ( ) {
106106 glob . sync ( './app/pages/**/*.js' ) . forEach ( function ( name ) {
107107 var n = name . slice ( name . lastIndexOf ( 'app/' ) + 10 , name . length - 3 ) ;
108- entry [ n ] = [ name ] ;
108+ entries [ n ] = [ name ] ;
109+ chunks . push ( n ) ;
109110 } ) ;
110- return entry ;
111- }
112- function getChunkName ( ) {
113- var entry = [ ] ;
114- glob . sync ( './app/pages/**/*.js' ) . forEach ( function ( name ) {
115- var n = name . slice ( name . lastIndexOf ( 'app/' ) + 10 , name . length - 3 ) ;
116- entry . push ( n ) ;
117- } ) ;
118- return entry ;
119111}
112+
120113function getHtmls ( ) {
121- var entry = [ ] ;
114+ var htmls = [ ] ;
122115 glob . sync ( './app/pages/**/*.html' ) . forEach ( function ( name ) {
123116 var n = name . slice ( name . lastIndexOf ( 'app/' ) + 4 , name . length - 5 ) ;
124- entry . push ( n ) ;
117+ htmls . push ( n ) ;
125118 } ) ;
126- return entry ;
119+ return htmls ;
127120}
128121
129122if ( process . env . NODE_ENV === 'production' ) {
You can’t perform that action at this time.
0 commit comments