File tree 3 files changed +23
-3
lines changed
3 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -297,7 +297,12 @@ impl RequireJsBuildConfig {
297
297
)
298
298
} )
299
299
. collect ( ) ;
300
- items. join ( "\n " )
300
+
301
+ if items. len ( ) > 0 {
302
+ items. join ( "\n " )
303
+ } else {
304
+ include_str ! ( "./js/no-loaders.js" ) . to_string ( )
305
+ }
301
306
}
302
307
///
303
308
/// Walk the mixins fields and flatten to a simple Vec<String>
Original file line number Diff line number Diff line change
1
+ /*
2
+ *
3
+ * You haven't configured any modules yet, so you don't
4
+ * need this 'loaders.js' file.
5
+ *
6
+ * Once you configure some additional bundles this file
7
+ * will be populated with some Javascript :)
8
+ *
9
+ */
Original file line number Diff line number Diff line change @@ -41,13 +41,19 @@ fn test_config_json() {
41
41
42
42
#[ test]
43
43
fn test_loaders_js ( ) {
44
- api_get ( DEFAULT_ARGS . to_vec ( ) , "/__bs/loaders.js" , |result| {
45
- let ( _sys, _url, res) = result. expect ( "api returned" ) ;
44
+ let args = & [
45
+ "config-gen" ,
46
+ "http://example.com" ,
47
+ ] ;
48
+ api_get ( args. to_vec ( ) , "/__bs/loaders.js" , |result| {
49
+ let ( _sys, _url, mut res) = result. expect ( "api returned" ) ;
50
+ let t = & res. text ( ) . expect ( "unwrap text response" ) ;
46
51
let ct = & res
47
52
. headers ( )
48
53
. get ( http:: header:: CONTENT_TYPE )
49
54
. expect ( "has content-type" ) ;
50
55
assert_eq ! ( ct. to_str( ) . expect( "header->str" ) , "application/javascript" ) ;
56
+ assert ! ( t. len( ) > 0 ) ;
51
57
} ) ;
52
58
}
53
59
You can’t perform that action at this time.
0 commit comments