diff --git a/config/webpack.vendor.js b/config/webpack.vendor.js index 256d506102b..4c9ae5e80d6 100644 --- a/config/webpack.vendor.js +++ b/config/webpack.vendor.js @@ -67,5 +67,5 @@ module.exports = [ 'jstz', 'urijs', 'uuid', - '@novnc/novnc/core/rfb.js', + // '@novnc/novnc/core/rfb.js', ]; diff --git a/webpack/assets/javascripts/bundle_novnc.js b/webpack/assets/javascripts/bundle_novnc.js index 878f4bd35ed..33ca3f3550a 100644 --- a/webpack/assets/javascripts/bundle_novnc.js +++ b/webpack/assets/javascripts/bundle_novnc.js @@ -1,5 +1,3 @@ -import RFB from '@novnc/novnc/core/rfb'; - let rfb; const StatusLevelLookup = { failed: 'danger', @@ -59,16 +57,21 @@ $(document).on('ContentLoad', () => { const url = `${protocol}://${host}:${port}`; const password = $('#vnc').attr('data-password'); - rfb = new RFB(vncScreen.get(0), url, { - credentials: { - password, - }, - }); + import(/* webpackChunkName: "noVNC" */ '@novnc/novnc/core/rfb').then( + module => { + showStatus('disconnected', __('Loading...')); + const RFB = module.default; - rfb.addEventListener('connect', connectFinished); - rfb.addEventListener('disconnect', disconnectFinished); - rfb.addEventListener('securityfailure', securityFailed); + rfb = new RFB(vncScreen.get(0), url, { + credentials: { + password, + }, + }); - showStatus('disconnected', __('Loading...')); + rfb.addEventListener('connect', connectFinished); + rfb.addEventListener('disconnect', disconnectFinished); + rfb.addEventListener('securityfailure', securityFailed); + } + ); } });