Javascript 节点模块(@pusher/push notifications web)无法在刷新页面上导入-nextjs
在集成节点模块时面临此问题Javascript 节点模块(@pusher/push notifications web)无法在刷新页面上导入-nextjs,javascript,node.js,reactjs,next.js,pusher,Javascript,Node.js,Reactjs,Next.js,Pusher,在集成节点模块时面临此问题@pusher/push notifications web 我不确定这是NextJs还是节点模块本身的问题 当页面第一次加载时,一切正常,但如果我们刷新页面或将用户重定向到新页面,则一切正常。我得到了这个错误 可以通过使用next.js配置中的next transfile modules传输@pusher/push notifications web模块(导出为ESM)来解决此问题: //next.config.js const with tm=require('n
@pusher/push notifications web
我不确定这是NextJs还是节点模块本身的问题
当页面第一次加载时,一切正常,但如果我们刷新页面或将用户重定向到新页面,则一切正常。我得到了这个错误
可以通过使用next.js配置中的
next transfile modules
传输@pusher/push notifications web
模块(导出为ESM)来解决此问题:
//next.config.js
const with tm=require('next-transfile-modules')(['@pusher/push-notifications-web']);
module.exports=withTM({/*自定义配置*/});