ghostery / adblocker

Efficient embeddable adblocker library

Home Page:https://www.ghostery.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

preload script must have absolute path in electron

anonrig opened this issue · comments

We are using Webpack with our Electron application and upon adding the integration I'm receiving the following error:

[28752:0812/082043.551169:ERROR:session_preferences.cc(38)] preload script must have absolute path: ../../common/temp/node_modules/.pnpm/@cliqz+adblocker-electron-preload@1.23.8_electron@20.0.1/node_modules/@cliqz/adblocker-electron-preload/dist/preload.es6.js
commented

Hi @anonrig,

Thanks for reaching out. Can you give more context on how you integrate the adblocker into your project?
Is it possible that the error might be caused by the following not being an absolute path? https://github.com/ghostery/adblocker/blob/master/packages/adblocker-electron/adblocker.ts#L18

Yes that's true. For the time being, we're using it through just copying the adblocker-electron to our existing code base. We had a similar issue with Sentry, and they solved it. I believe that the preload script path should start with a path.join(__dirname) or etc. to solve this issue.

commented

Thanks, that makes sense. Would you be able to open a PR with this change? I'd be happy to review it and publish a new version with this fix.

@anonrig I'm having the same problem and copy-pasting the source code over doesn't fix it, can you make a PR for me?

same here!