-
Notifications
You must be signed in to change notification settings - Fork 1.5k
How to include a webpack module using file protocol i.e. 'file://' #239
Comments
The best way to approach this would be to treat your let pathToInjectScript = `file://${path.join(__static, '/inject.js')}` Yes this method loses all The alternative method would be to manually adjust the Related: #236 |
Closing due to inactivity. Please feel free to comment back any further questions. Like I said previously, there are not any current plans to support a |
I have also encountered this problem, has been resolved, and I hope to help you setting preload:
setting for vue data:
|
@yhostc I'm having some problems with this.. in your preload.js file, how do you test that the preload file has indeed been loaded? Thanks in advance! |
we can send message to the webview in preload.js, through by ipc renderer |
@yhostc thanks for your response! I was able to also load the preload file successfully. That being said, I was wondering if there was any way that the webview could send some data to the ipcMain or ipcRenderer in the electron app though, hmm |
I managed to get my webpack-built preload file loaded via the file:// protocol by adding a separate entrypoint for it and then using https://www.npmjs.com/package/write-file-webpack-plugin to force the compiled files being written to disk despite dev-server being used. |
I place the preload.js in the <webview :preload="preload"></webview> preload: `file:${require('path').resolve(__static, './preload.js')}` |
The build is invalid because it will go to the installation directory to look for the files: |
I want to load a js module as webview preload script:
when i try to include inject.js like this it won't be found since webpack is being used to pack/build the project and it expects require('./inject.js'). At the same time expects file:// protocol url as preload argument...
How can I include modules with webpack using file:// protocol?
Any help would be greatly appreciated, since I ran out of options, and my last resort is to dig in Webpack , which I'm trying to avoid...
The text was updated successfully, but these errors were encountered: