jlalmes / trpc-chrome

tRPC adapter for Web Extensions 🧩
https://www.npmjs.com/package/trpc-chrome
MIT License
270 stars 21 forks source link

trpc with webpack in prod bundle #10

Closed sleaper closed 1 year ago

sleaper commented 1 year ago

Hi guys, I am using tRPC in my chrome extension. I use webpack for bundling. When I am in dev mode it works perfectly, but when I run production build, I got this error: (in firefox) obrazek

(in chrome) image

In production I need to have files under 4MB for firefox store upload, so I use this setting in webpack:

obrazek

I am guessing the error is because of the chunk splitting? Do you have any idea what could be wrong? If you have any questions feel free to ask!

capaj commented 1 year ago

this was totally problem on our end. What happens with webpack chunks is that the chunked code only really works when included as multiple script tags, but we were only loading the main chunk so it never even ran on bacground page side. It works awesomely now that we use a custom index.html for background page generated from webpack.