You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just importing the client, I got this error (I had the same problem with kysely + d1:
[vite-node-miniflare error]
ReferenceError: require is not defined
at /home/piero/dev/react-router-aws-sdk/node_modules/fast-xml-parser/src/fxp.js:3:19
at Object.runViteModule (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1320:15)
at ViteRuntime.directRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1231:78)
at ViteRuntime.cachedRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1154:28)
at request (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1181:128)
at /node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js?v=7d5560d3:2:31
at Object.runViteModule (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1320:9)
at ViteRuntime.directRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1231:60)
at ViteRuntime.cachedRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1155:79)
at /node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js?v=7d5560d3:10:31
The text was updated successfully, but these errors were encountered:
This isn't a bug with the library. Those dependencies down the chain are CJS modules and aren't getting transpiled by Vite for some reason. This isn't related to the library.
The funny part is that, it doesn't happen with the default template, just with the Cloudflare one. Shouldn't that be a default behavior of the Cloudflare template?
I'm using React Router as a...
framework
Reproduction
Using the @aws-sdk/client-s3 with the Cloudflare template.
npx create-react-router@latest --template remix-run/react-router-templates/cloudflare
npm install @aws-sdk/client-s3
Import the client:
A repro repository:
https://github.com/pierophp/react-router-cloudflare-aws-sdk
System Info
Used Package Manager
npm
Expected Behavior
Import a CJS module with the Cloudflare template
The S3 Client is support by Cloudflare:
https://developers.cloudflare.com/r2/examples/aws/aws-sdk-js-v3/
Actual Behavior
Just importing the client, I got this error (I had the same problem with kysely + d1:
[vite-node-miniflare error]
ReferenceError: require is not defined
at /home/piero/dev/react-router-aws-sdk/node_modules/fast-xml-parser/src/fxp.js:3:19
at Object.runViteModule (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1320:15)
at ViteRuntime.directRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1231:78)
at ViteRuntime.cachedRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1154:28)
at request (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1181:128)
at /node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/parseXmlBody.js?v=7d5560d3:2:31
at Object.runViteModule (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1320:9)
at ViteRuntime.directRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1231:60)
at ViteRuntime.cachedRequest (home/piero/dev/react-router-aws-sdk/node_modules/@hiogawa/vite-node-miniflare/dist/worker-entry.js:1155:79)
at /node_modules/@aws-sdk/core/dist-es/submodules/protocols/index.js?v=7d5560d3:10:31
The text was updated successfully, but these errors were encountered: