Uncaught SyntaxError in Theme Extension js file

Topic summary

A developer is encountering an \

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

Hi! I’m new to Shopify development, so this is probably a simple question. I made a shopify app that has a working front-end, back-end, and a theme extension (page widget). So it’s structured something like this:

extensions
  page-widget
     assets
        block.js
      blocks
        block.liquid
      shopify.theme.extension.toml
web
  package.json
  frontend
     package.json
package.json

The block.js file is linked to the block.liquid file in the liquid file schema. However when I run my app locally, and open the extension in my development store, I get the “Uncaught SyntaxError: Cannot use import statement outside a module” error on my block.js file because I have an import statement there:

import { useAppQuery } from "../../../web/frontend/hooks";

I have 3 package.json files, and each has “theme”: “module”, so I’m not sure what else to try? It’s only getting triggered in the block.js file and not any of the other .js files I have…

1 Like

I am also having this issue, did anyone know the solution