Open bkspace opened 3 weeks ago
This issue exists because of the version of esbuild
(0.17.19
- May 2023) used by wrangler
. Support for import attributes
in esbuild is introduced in 0.20.x
. The next major version of wrangler
will only support 0.18.x
afaik, i.e it still won't support import attributes.
@paulomarg - this is not a shopify-app-js
issue so this should be closed. It would be great to get your input into how we should best proceed. Is the best approach here to use the CJS export until wrangler
supports a more modern version of esbuild?
Same problem here - I am not deploying on cloudflare but local test development
Also same issue on local test development.
@bkspace If I've understand your explaination, it does not work well just because the last version of @shopify/app (3.58.2) still uses esbuild 0.19.8?
@bkspace Maybe Try overriding the version by adding to your package.json
"resolutions": { "esbuild": "0.21.5" }, "overrides": { "esbuild": "0.21.5" },
Then re-generate the package lock file and deploy, that did the trick for me
@OlivierNguyen - specifically wrangler uses 0.17.x
of esbuild - so wrangler dev
and wrangler deploy
will fail with this error.
@devil1991 - Nice! We didn't go down that path because there are issues with upgrading wrangler to newer esbuild (have been following their attempts/issues). If it works, it works, but for the time being we're happy with just patching out the with { type: 'json' }
!
Issue summary
Before opening this issue, I have:
@shopify/*
package and version:{ logger: { level: LogSeverity.Debug } }
in my configuration, when applicableDeployment to Cloudflare Pages fails when compiling worker with:
Expected ";" but found "with"
->/node_modules/@shopify/shopify-app-remix/dist/esm/react/components/AppProvider/AppProvider.mjs:3:59:
Expected behavior
Deployment of a Shopify application to Cloudflare pages should succeed.
Actual behavior
What actually happens?
Steps to reproduce the problem
In order to get this package to deploy to cloudflare:
1.) Refactor
shopify.server.ts
to usecloudflare ctx
instead ofprocess.env
to get environment variables. 2.) Swap out@remix-run/node
for@remix-run/cloudflare
3.) Updateentry.server.tsx
to be compatible with cloudflare (If I remember correctly 4.) usecloudflareDevProxyVitePlugin as remixCloudflareDevProxy
invite.config.ts
5.) A couple of other small tweaksI'm happy to setup as base level repository if that would make life simpler.
npx wrangler pages deploy --project-name=foo /build/client
~As a temporary fix, we are using the CJS export of
AppProvider
(i.econst { AppProvider} = require("@shopify/shopify-app-remix/react");
~^ this does not actually work.
Have also posted this in the CF discord to get opinions on where the issue may lie :)
Debug logs