How can I include JS code in theme app extensions?

Topic summary

A developer is trying to include JavaScript files in Shopify theme app extensions but encounters persistent 404 errors.

Initial Problem:

  • Standard {% javascript %} tags don’t work in theme app extensions
  • JS file placed in assets folder returns 404 when referenced

Attempted Solutions:

  • Using {{ 'filename.js' | asset_url | script_tag }} markup
  • Declaring javascript in the schema block of liquid files
  • Various file naming conventions (test.js, app.js)

Working Solution:

  • The issue was identified as a caching problem
  • Resolution steps:
    1. Remove the block from the theme
    2. Deploy a new version of the extension
    3. Re-add the block to the theme
  • JS file should be in the assets folder (not “asset”)
  • Declare in schema as: "javascript": "app.js"

Status: Resolved. The original poster confirmed it worked after following the cache-clearing process. Another user later requested clarification on the exact steps.

Summarized with AI on November 10. AI used: claude-sonnet-4-5-20250929.

Hi Girish_Rajwani,

I think you should remove the block, and deploy the new version of extension. Then add the block to your theme again.

I guess it’s a caching issue.

Regards,

1 Like