adblocker icon indicating copy to clipboard operation
adblocker copied to clipboard

preload script must have absolute path in electron

Open anonrig opened this issue 3 years ago • 3 comments
trafficstars

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/@[email protected][email protected]/node_modules/@cliqz/adblocker-electron-preload/dist/preload.es6.js

anonrig avatar Aug 12 '22 12:08 anonrig

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

remusao avatar Aug 28 '22 20:08 remusao

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.

anonrig avatar Aug 28 '22 21:08 anonrig

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.

remusao avatar Aug 28 '22 21:08 remusao

@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?

PascalPixel avatar Nov 14 '22 14:11 PascalPixel

same here!

AhmedMuhammed7 avatar Dec 04 '22 20:12 AhmedMuhammed7