File tree Expand file tree Collapse file tree 1 file changed +19
-8
lines changed
Expand file tree Collapse file tree 1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -27,31 +27,42 @@ if (typeof window !== "undefined" && window.navigator && window.document) {
2727
2828define ( [
2929 //>>excludeStart('excludeBabel', pragmas.excludeBabel)
30- 'babel'
30+ 'babel' ,
3131 //>>excludeEnd('excludeBabel')
32+ 'module'
3233] , function (
3334 //>>excludeStart('excludeBabel', pragmas.excludeBabel)
34- babel
35+ babel ,
3536 //>>excludeEnd('excludeBabel')
37+ _module
3638 ) {
3739 return {
3840 load : function ( name , req , onload , config ) {
3941 //>>excludeStart('excludeBabel', pragmas.excludeBabel)
40- var url = req . toUrl ( name + '.js' ) ;
41-
42- fetchText ( url , function ( text ) {
43- var code = babel . transform ( text , {
42+ function applyOptions ( options ) {
43+ var defaults = {
4444 modules : 'amd' ,
4545 sourceMap : config . isBuild ? false :'inline' ,
4646 sourceFileName : name ,
4747 stage : 1
48- } ) . code ;
48+ } ;
49+ for ( var key in options ) {
50+ if ( options . hasOwnProperty ( key ) ) {
51+ defaults [ key ] = options [ key ] ;
52+ }
53+ }
54+ return defaults ;
55+ }
56+ var url = req . toUrl ( name + '.js' ) ;
57+
58+ fetchText ( url , function ( text ) {
59+ var code = babel . transform ( text , applyOptions ( _module . config ( ) ) ) . code ;
4960
5061 if ( config . isBuild ) {
5162 _buildMap [ name ] = code ;
5263 }
5364
54- onload . fromText ( code ) ;
65+ onload . fromText ( code ) ;
5566 } ) ;
5667 //>>excludeEnd('excludeBabel')
5768 } ,
You can’t perform that action at this time.
0 commit comments