I am getting the below error after initializing pusher on nextjs application:
export { Client, RegistrationState, TokenProvider };
^^^^^^
SyntaxError: Unexpected token 'export'
I have also tried modifying the next.config.js file to the following:
const withTM = require("next-transpile-modules")(["@pusher/push-notifications-web"])
module.exports = withTM({
env: {
apiBaseUrl: "",
apiBaseUrlChat: ""
},
});
When I am trying to execute npm run dev, it is giving me the following error:
TypeError: modules.map is not a function
index.jsto the package, doing sonext-transpile-modulesworked and I was able to use the lib. Sounds stupid, but that did the job in my case.node_modulesto check whether or not this is the issue.