Shopify App Build issue

Topic summary

Builds of a Shopify app (Express template) started injecting require(“react”) into the Vite output, causing a browser runtime error: “Uncaught ReferenceError: require is not defined.” A screenshot shows the error; no other attachments are essential.

Attempts to mitigate included:

  • Excluding suspect deps via Vite’s optimizeDeps.
  • Confirming the app code doesn’t use require.
  • Adding Vite’s CommonJS plugin.
  • Considering a StackOverflow suggestion to transform require during asset build.
  • Temporarily rolling back the container image (worked but not feasible).

Root cause and fix:

  • Shopify’s internal teams identified the issue in their i18nFormat plugin for the i18next library (i18next is an internationalization framework; the plugin formats translations).
  • A fix was shipped; updating @shopify/i18next-shopify to version 0.2.9 resolves the error.

Outcome:

  • After updating the package, the app builds and loads correctly.

Status and actions:

  • Resolved. Developers should update @shopify/i18next-shopify to 0.2.9.
  • If the issue persists after updating, report back.
Summarized with AI on January 12. AI used: gpt-5.

Hi again SlangLabs,

The Shopify internal dev teams have investigated this issue and it appears it was related to our i18nFormat plugin for the i18next library. We’ve shipped a fix to the above plugin to resolve this, so to fix this issue developers should update @Shopify_77 /i18next-shopifyto 0.2.9. If anyone is still experiencing this problem after updating please let us know.

Hope this helps!

1 Like