Closed DenizKucukozturk closed 2 years ago
Same here.
Although, I am also getting this same error when trying to import the entire package as it says to do so in the docs.
import * as braze from "@braze/web-sdk";
^ returns the same Unexpected token 'export'
error.
It looks like we need to add "type": "module"
to our package.json for Next.js to recognize the SDK as ES Modules. We should have a fix out for this soon.
@wtfluckey Can you confirm that you're also using Next.js?
Yes, I am using Next.js.
Hi @DenizKucukozturk @wtfluckey. We just released 4.0.1, which adds "type": "module"
to the package.json. I'm going to close out the issue, but feel free to to re-open or file another issue if you continue to encounter issues.
@wesleyorbin Thank you so much for the quick fix! I have tried version 4.0.1 and it does seem to fix the Unexpected token 'export'
error. However, I am running into a new error, so I have created a new Github issue here: #117. Thanks for all your help!
Braze Web SDK Version
4.0.0
Integration Method
NPM
Browser
Chrome
Steps To Reproduce
I am using React with Next.js. When trying to do an partial import such as
import { changeUser } from "@braze/web-sdk";
I get the error:
Expected Behavior
I expected a successful partial import.
Actual Incorrect Behavior
Got the error SyntaxError: Unexpected token 'export'
Verbose Logs
No response
Additional Information
No response