Livechat API issue in Webpack bundle
답변함The below code will not run properly in scripts bundled by Webpack (3.5.6), at least with the plugins and loaders I'm using:
$zopim(function() {
The livechat property is always undefined.
I believe this issue stems from the use of strict mode inside of zopim. The callback function $zopim(function() { … }) inherits the use of strict mode, which causes certain properties, such as 'livechat', to be inaccessible.
The best way I found to access $zopim.livechat from within Webpack was through the following:
livechat = (new Function('return window.$zopim.livechat;'))();
-
Hi Erik,
Thanks for posting your question. I shared your use case with the developers who work on the widget and they were unable to reproduce the problem you are experiencing using Webpack.
Can you point me to the URL or code in Github that I can share with the developers to see why it isn't working for you?
-Ramin
-
Hi Ramin,
Unfortunately our codebase can not be shared publicly.
It’s possible the issue isn’t caused by Webpack itself but by some of the loaders we’re using with it.
Thanks for following up.
댓글을 남기려면 로그인하세요.
2 댓글