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.js
to the package, doing sonext-transpile-modules
worked and I was able to use the lib. Sounds stupid, but that did the job in my case. – Belletristnode_modules
to check whether or not this is the issue. – Belletristready - started server on 0.0.0.0:3000, url: http://localhost:3000 info - Using webpack 4. Reason: custom webpack configuration in next.config.js https://nextjs.org/docs/messages/webpack5 info - automatically enabled Fast Refresh for 1 custom loader (node:18500) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'startsWith' of undefined
– Matriarchy