App extension code splitting

Topic summary

App extension code splitting for a subscription app extension is hitting size limits and runtime errors.

  • Build error: main.js is 291 KiB, exceeding the recommended 244 KiB entrypoint/asset limit. Error logs specify the entrypoint “main” at 291 KiB.
  • Attempted fix: using React.lazy and dynamic import for code splitting. This led to a runtime error: “TypeError: importScripts is not a function” from extension.js on localhost.
  • Context: importScripts is a Web Worker API; the error indicates it’s not available in the extension’s runtime. The code splitting change was intended to reduce bundle size to meet limits.
  • Additional reports: another participant suspects an Argo extension issue, stating they can compile but cannot push to Shopify. A third participant asks if a solution was found, reporting the same problem.
  • Status: no resolution or action items recorded. Discussion remains open, with users seeking information or workarounds.
Summarized with AI on February 15. AI used: gpt-5.

When I tried to build my subscription app extension, I got this error.

Error: Error compiling: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  main.js (291 KiB),entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (291 KiB)
      main.js

So I changed my code to use React.lazy and dynamic import, but now I get the error below.

TypeError: importScripts is not a function
    at http://localhost:39351/assets/extension.js?reload=0:817:14
    at async Promise.all (index 0)

I know this is a niche issue but I would appreciate it if someone could provide information about how to deal with this.

And please tell me if I need to provide more information. Thanks.

Hey, there seems to be a problem with the argo extension. The same thing is going on for me too. I am able to compile but unable to push the code to shopify.

Hi, @d_tehrani .

Have you ever figured out the solution to this problem of yours? I’m experiencing it now. Thanks!