@@ -17,10 +17,7 @@ const defaultOptions = {
1717 browserifyOptions : {
1818 extensions : [ '.js' , '.jsx' , '.coffee' , '.cjsx' ] ,
1919 transform : [
20- [
21- require . resolve ( './cjsxify' ) ,
22- { } ,
23- ] ,
20+ [ require . resolve ( './cjsxify' ) , { } ] ,
2421 [
2522 require . resolve ( 'babelify' ) ,
2623 {
@@ -30,7 +27,9 @@ const defaultOptions = {
3027 plugins : [ 'babel-plugin-add-module-exports' ] . map ( require . resolve ) ,
3128 // babel-preset-env supports any JS that's stage-4, meaning it's
3229 // completely finalized in the ECMA standard
33- presets : [ 'babel-preset-env' , 'babel-preset-react' ] . map ( require . resolve ) ,
30+ presets : [ 'babel-preset-env' , 'babel-preset-react' ] . map (
31+ require . resolve
32+ ) ,
3433 } ,
3534 ] ,
3635 ] ,
@@ -61,8 +60,16 @@ const preprocessor = (options = {}) => {
6160 log ( 'received user options' , options )
6261
6362 // allow user to override default options
64- const browserifyOptions = Object . assign ( { } , defaultOptions . browserifyOptions , options . browserifyOptions )
65- const watchifyOptions = Object . assign ( { } , defaultOptions . watchifyOptions , options . watchifyOptions )
63+ const browserifyOptions = Object . assign (
64+ { } ,
65+ defaultOptions . browserifyOptions ,
66+ options . browserifyOptions
67+ )
68+ const watchifyOptions = Object . assign (
69+ { } ,
70+ defaultOptions . watchifyOptions ,
71+ options . watchifyOptions
72+ )
6673
6774 // we return function that accepts the arguments provided by
6875 // the event 'file:preprocessor'
@@ -152,18 +159,20 @@ const preprocessor = (options = {}) => {
152159 log ( `update ${ filePath } ` )
153160 // we overwrite the cached bundle promise, so on subsequent invocations
154161 // it gets the latest bundle
155- const bundlePromise = bundles [ filePath ] = bundle ( )
156- . finally ( ( ) => {
162+ const bundlePromise = bundle ( ) . finally ( ( ) => {
157163 log ( `- update finished for ${ filePath } ` )
158164 file . emit ( 'rerun' )
159165 } )
166+ bundles [ filePath ] = bundlePromise
160167 // we suppress unhandled rejections so they don't bubble up to the
161168 // unhandledRejection handler and crash the app. Cypress will eventually
162169 // take care of the rejection when the file is requested
163170 bundlePromise . suppressUnhandledRejections ( )
164171 } )
165172
166- const bundlePromise = fs . ensureDirAsync ( path . dirname ( outputPath ) ) . then ( bundle )
173+ const bundlePromise = fs
174+ . ensureDirAsync ( path . dirname ( outputPath ) )
175+ . then ( bundle )
167176
168177 // cache the bundle promise, so it can be returned if this function
169178 // is invoked again with the same filePath
0 commit comments