You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
My electron app includes a webview tag with preload script. I would like to use typescript for the preload script, but electron-prebuilt-compile doesn't compile it. I tried following https://github.com/electron-userland/electron-forge/wiki/Using-'preload'-scripts (as suggested in #259), but that doesn't work. Instead I get the following on the dev console:
Unable to load preload script: [[PROJECTDIR]]\src\preload-launcher.js
Error: Failed to execute 'registerElement' on 'Document': Registration failed for type 'x-require'. Elements cannot be registered from extensions.
at exports.default ([[PROJECTDIR]]\node_modules\electron-compile\lib\x-require.js:51:19)
at Object.<anonymous> ([[PROJECTDIR]]\node_modules\electron-compile\lib\x-require.js:52:3)
at Object.<anonymous> ([[PROJECTDIR]]\node_modules\electron-compile\lib\x-require.js:54:3)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
The text was updated successfully, but these errors were encountered:
Turns out that the problem disappears and the linked wiki entry works if I don't enable contextIsolation for the webview. With contextIsolation, I get the previously mentioned error.
This is an acceptable workaround for development, but I would very much like to have Context Isolation active if possible. Is it possible to make electron-compile cooperate with context isolation?
leofidus
changed the title
preload script for webview not working
preload script for webview not working when contextIsolation is activated
Mar 3, 2018
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
My electron app includes a webview tag with preload script. I would like to use typescript for the preload script, but electron-prebuilt-compile doesn't compile it. I tried following https://github.com/electron-userland/electron-forge/wiki/Using-'preload'-scripts (as suggested in #259), but that doesn't work. Instead I get the following on the dev console:
The text was updated successfully, but these errors were encountered: