File tree 4 files changed +44
-15
lines changed
4 files changed +44
-15
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ var paths = require('./paths');
16
16
module . exports = {
17
17
devtool : 'eval' ,
18
18
entry : [
19
- require . resolve ( 'webpack-dev-server/client' ) ,
19
+ require . resolve ( 'webpack-dev-server/client' ) + '?/' ,
20
20
require . resolve ( 'webpack/hot/dev-server' ) ,
21
21
require . resolve ( './polyfills' ) ,
22
22
path . join ( paths . appSrc , 'index' )
@@ -25,7 +25,7 @@ module.exports = {
25
25
// Next line is not used in dev but WebpackDevServer crashes without it:
26
26
path : paths . appBuild ,
27
27
pathinfo : true ,
28
- filename : 'bundle.js' ,
28
+ filename : 'static/js/ bundle.js' ,
29
29
publicPath : '/'
30
30
} ,
31
31
resolve : {
@@ -75,11 +75,18 @@ module.exports = {
75
75
test : / \. ( j p g | p n g | g i f | e o t | s v g | t t f | w o f f | w o f f 2 ) $ / ,
76
76
include : [ paths . appSrc , paths . appNodeModules ] ,
77
77
loader : 'file' ,
78
+ query : {
79
+ name : 'static/media/[name].[ext]'
80
+ }
78
81
} ,
79
82
{
80
83
test : / \. ( m p 4 | w e b m ) $ / ,
81
84
include : [ paths . appSrc , paths . appNodeModules ] ,
82
- loader : 'url?limit=10000'
85
+ loader : 'url' ,
86
+ query : {
87
+ limit : 10000 ,
88
+ name : 'static/media/[name].[ext]'
89
+ }
83
90
}
84
91
]
85
92
} ,
Original file line number Diff line number Diff line change @@ -31,8 +31,8 @@ module.exports = {
31
31
] ,
32
32
output : {
33
33
path : paths . appBuild ,
34
- filename : '[name].[chunkhash:8].js' ,
35
- chunkFilename : '[name].[chunkhash:8].chunk.js' ,
34
+ filename : 'static/js/ [name].[chunkhash:8].js' ,
35
+ chunkFilename : 'static/js/ [name].[chunkhash:8].chunk.js' ,
36
36
publicPath : publicPath
37
37
} ,
38
38
resolve : {
@@ -86,13 +86,17 @@ module.exports = {
86
86
include : [ paths . appSrc , paths . appNodeModules ] ,
87
87
loader : 'file' ,
88
88
query : {
89
- name : '[name].[hash:8].[ext]'
89
+ name : 'static/media/ [name].[hash:8].[ext]'
90
90
}
91
91
} ,
92
92
{
93
93
test : / \. ( m p 4 | w e b m ) $ / ,
94
94
include : [ paths . appSrc , paths . appNodeModules ] ,
95
- loader : 'url?limit=10000'
95
+ loader : 'url' ,
96
+ query : {
97
+ limit : 10000 ,
98
+ name : 'static/media/[name].[hash:8].[ext]'
99
+ }
96
100
}
97
101
]
98
102
} ,
@@ -139,6 +143,6 @@ module.exports = {
139
143
screw_ie8 : true
140
144
}
141
145
} ) ,
142
- new ExtractTextPlugin ( '[name].[contenthash:8].css' )
146
+ new ExtractTextPlugin ( 'static/css/ [name].[contenthash:8].css' )
143
147
]
144
148
} ;
Original file line number Diff line number Diff line change @@ -40,16 +40,28 @@ webpack(config).run(function(err, stats) {
40
40
. filter ( asset => / \. ( j s | c s s ) $ / . test ( asset . name ) )
41
41
. map ( asset => {
42
42
var fileContents = fs . readFileSync ( paths . appBuild + '/' + asset . name ) ;
43
+ var size = gzipSize ( fileContents ) ;
43
44
return {
44
- name : asset . name ,
45
- size : gzipSize ( fileContents )
45
+ folder : path . join ( 'build' , path . dirname ( asset . name ) ) ,
46
+ name : path . basename ( asset . name ) ,
47
+ size : size ,
48
+ sizeLabel : filesize ( size )
46
49
} ;
47
50
} ) ;
48
51
assets . sort ( ( a , b ) => b . size - a . size ) ;
52
+
53
+ var longestSizeLabelLength = Math . max . apply ( null ,
54
+ assets . map ( a => a . sizeLabel . length )
55
+ ) ;
49
56
assets . forEach ( asset => {
57
+ var sizeLabel = asset . sizeLabel ;
58
+ if ( sizeLabel . length < longestSizeLabelLength ) {
59
+ var rightPadding = ' ' . repeat ( longestSizeLabelLength - sizeLabel . length ) ;
60
+ sizeLabel += rightPadding ;
61
+ }
50
62
console . log (
51
- ' ' + chalk . dim ( 'build' + path . sep ) + chalk . cyan ( asset . name ) + ': ' +
52
- chalk . green ( filesize ( asset . size ) )
63
+ ' ' + chalk . green ( sizeLabel ) +
64
+ ' ' + chalk . dim ( asset . folder + path . sep ) + chalk . cyan ( asset . name )
53
65
) ;
54
66
} ) ;
55
67
console . log ( ) ;
Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ npm run build
61
61
62
62
# Check for expected output
63
63
test -e build/* .html
64
- test -e build/* .js
64
+ test -e build/static/js/* .js
65
+ test -e build/static/css/* .css
66
+ test -e build/static/media/* .svg
65
67
66
68
# Pack CLI
67
69
cd global-cli
@@ -84,7 +86,9 @@ npm run build
84
86
85
87
# Check for expected output
86
88
test -e build/* .html
87
- test -e build/* .js
89
+ test -e build/static/js/* .js
90
+ test -e build/static/css/* .css
91
+ test -e build/static/media/* .svg
88
92
89
93
# Test the server
90
94
npm start -- --smoke-test
@@ -95,7 +99,9 @@ npm run build
95
99
96
100
# Check for expected output
97
101
test -e build/* .html
98
- test -e build/* .js
102
+ test -e build/static/js/* .js
103
+ test -e build/static/css/* .css
104
+ test -e build/static/media/* .svg
99
105
100
106
# Test the server
101
107
npm start -- --smoke-test
You can’t perform that action at this time.
0 commit comments