gobblejs / gobble

The last build tool you'll ever need
333 stars 20 forks source link

Mystifying gobble error on browserify #87

Open martypdx opened 9 years ago

martypdx commented 9 years ago

We replicated our working gobble build to a new project and hit a roadblock.

Essentially, there are js files getting merged and then browserified via:

var bundle = gobble( [ components, js, vendor ] )
    .transform( 'browserify', {
        entries: './index.js',
        configure: function ( bundle ) {
            excludeModules.forEach( function( module ) {
                bundle.exclude( module );
            });
        },
        dest: 'bundle.js',
        debug: gobble.env() !== 'production'
    });

I can see in the .gobble dir that the merge happens successfully, but then it fails in the browserify step with:

∙∙∙∙∙∙∙ 18-browserify running...                                                                                                        
gobble: 18-browserify transformation failed

input:  /Users/marty/ractive-starter-project/.gobble/17-merge/1
output: /Users/marty/ractive-starter-project/.gobble/18-browserify/1
>>>
Cannot find module './app' from '/Users/marty/ractive-starter-project/.gobble/05-babel/.cache'
Error: Cannot find module './app' from '/Users/marty/ractive-starter-project/.gobble/05-babel/.cache'
    at /Users/marty/ractive-starter-project/node_modules/gobble-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:55:21
    at load (/Users/marty/ractive-starter-project/node_modules/gobble-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex (/Users/marty/ractive-starter-project/node_modules/gobble-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at /Users/marty/ractive-starter-project/node_modules/gobble-browserify/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:95:15)
<<<

which is odd because it is looking in .gobble/05-babel/.cache folder which that is the pre-merge location of index.js, not the one in 17-merge/1. So it finds dependencies prior to the merge, but not those after the merge.