Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Watchify is breaking .require() calls with the expose option #74

Closed
binarykitchen opened this issue Aug 5, 2014 · 6 comments
Closed

Comments

@binarykitchen
Copy link

When the bundler is an instance of browserify, then this code works fine:

    var bundler = browserify({
            entries:        ['main.js],
            insertGlobals:  false,
            debug:          !settings.PRODUCTION // for source maps
        })

    bundler.require('/home/xxx/var/local/tmp/client_settings.json', {
        expose: 'client_settings.json'
    })

but when I wrap this with watchify like that:

    var bundler = watchify(browserify({
            entries:        ['main.js'],
            insertGlobals:  false,
            debug:          !settings.PRODUCTION // for source maps
        }), {
            watch: false
        })

    bundler.require('/home/xxx/var/local/tmp/client_settings.json', {
        expose: 'client_settings.json'
    })

then this error is thrown when bundling through a gulp task

TypeError: Cannot set property 'client_settings.json' of undefined
    at Browserify.<anonymous> (/home/xxx/node_modules/watchify/index.js:20:27)
    at Browserify.emit (events.js:95:17)
    at Transform._transform (/home/xxx/node_modules/browserify/index.js:475:14)
    at Transform._read (/home/xxx/node_modules/browserify/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js:184:10)
...
@neocoder
Copy link

neocoder commented Aug 5, 2014

Hi @binarykitchen, not sure if it will help in your situation but you can try to apply the patch I made to solve my problem #72 (comment)

@binarykitchen
Copy link
Author

thanks @neocoder - I prefer to wait until the patch is in on npm

@Pita
Copy link

Pita commented Aug 27, 2014

I see this too!

@Pita
Copy link

Pita commented Aug 27, 2014

This seems to be related to #72

@nervo
Copy link

nervo commented Mar 9, 2015

Same kind of issue there

@zertosh
Copy link
Member

zertosh commented Mar 25, 2015

I think this is related to #72. I'm going to close this out and follow it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants