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
import * as braze from '@braze/web-sdk';
// initialize the SDK
braze.initialize('API_KEY, {
baseUrl: "BASE_URL"
});
// optionally show all in-app messages without custom handling
braze.automaticallyShowInAppMessages();
// optionally set the current user's External ID
if (isLoggedIn){
braze.changeUser(userIdentifier);
}
Hi @raobjm. Browserify's default behavior is to not transform anything in the node_modules folder. It will need to be configured to transform our SDK and may need some additional configuration to be able to parse and transform ES modules. One option would be to add global: true to your browserify config and then set an ignore path that ignores everything in node_modules but the Braze SDK.
The original post here has an example at the bottom.
There's likely some other babel/browserify configuration option that you need to use, but I'm not overly familiar with browserify. Using "sourceType": "unambiguous" as mentioned here may fix the issue. The Web SDK is a native ES module, so any configuration that allows browserify to work with ES modules should work.
Braze Web SDK Version
4.0.2
Integration Method
NPM
Browser
Chrome
Steps To Reproduce
Adding braze integration:
Node Version: 12.0.0
Here is package.json: https://gist.github.com/raobjm/398ce330b863bbb90bdd1950e3dc50d1
Here is Gulp File: https://gist.github.com/raobjm/2dd4536b5c5609ae54884471cea43c95
and the contents of braze integration
Expected Behavior
No errors should be thrown at build
Actual Incorrect Behavior
Error we are getting while running the build
Verbose Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: