You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have used jsforce ver1.5.1 in my project.
Recently I tryed to update jsforce 1.6.0 but I failed to bundle the source using webpack.
Error messeage is below.
ERROR in .//jsforce/lib/cli/cli.js
Module not found: Error: Cannot resolve module 'repl' in ** node_modules path **
@ .//jsforce/lib/cli/cli.js 40:86-101
ERROR in .//commander/index.js
Module not found: Error: Cannot resolve module 'child_process' in ** node_modules path **
@ .//commander/index.js 6:12-36
It seems webpack is not correctly handling package's metadata field browser, so it will lookup module which is unavailable in browser environment. Use browserify for building browser module instead.
Hi Stomita,
I have the same problem here.
Can you be more clear about what to do to resolve this. I can not switch my build to browsify, since I have a more complex project.
Any help would be appreciated.
@dirajkumar@sgroschupf ver 1.6.3 is out and it has webpack bundling support. You need webpack.config.js with loader json-loader explicitly to create bundle without error.
In the bundling script you can do simply call require('jsforce'):
varjsforce=require('jsforce');// you can simply create a connection instancevarconn=newjsforce.Connection();// or you can use browser client object (which is only available in browser env).jsforce.browser.init({clientId: 'your oauth2 client id is here',redirectUri: 'your oauth2 redirect uri is here'});jsforce.browser.login();jsforce.browser.on('connect',function(conn){// ...});
Or you can use require('jsforce/core') to reduce the bundle size
// this only loads core script (without api modules)varjsforce=require('jsforce/core');// load chatter api module explicitlyrequire('jsforce/lib/api/chatter');varconn=newjsforce.Connection();console.log(conn.bulk)// undefinedconsole.log(conn.analytics)// undefinedconsole.log(conn.chatter)// [object]
Activity
stomita commentedon Mar 23, 2016
It seems webpack is not correctly handling package's metadata field
browser, so it will lookup module which is unavailable in browser environment. Use browserify for building browser module instead.sgroschupf commentedon May 1, 2016
Hi Stomita,
I have the same problem here.
Can you be more clear about what to do to resolve this. I can not switch my build to browsify, since I have a more complex project.
Any help would be appreciated.
dirajkumar commentedon May 5, 2016
@stomita I'm having similar issue. Can you please let me how to use webpack and jsforce together?
stomita commentedon May 5, 2016
@sgroschupf @dirajkumar I'll investigate and will include the webpack support in next patch release.
dirajkumar commentedon May 6, 2016
@stomita You're the best. When is the next release date? I'm really looking forward to it. Thanks a lot again.
stomita commentedon May 9, 2016
@dirajkumar @sgroschupf ver 1.6.3 is out and it has webpack bundling support. You need
webpack.config.jswith loaderjson-loaderexplicitly to create bundle without error.In the bundling script you can do simply call
require('jsforce'):Or you can use
require('jsforce/core')to reduce the bundle size