feat: use cloudflare-pages-plugin-trpc#1
Open
uxduck wants to merge 1 commit into
Open
Conversation
…marinyon/cloudflare-pages-plugin-trpc This is not yet working. Building (`pnpm dev`) gives an error: ```bash pnpm dev INT ✘ 06:48:00 pm > trpc-astro-cloudflare@0.0.1 dev /Users/zen/Desktop/trpc-astro-cloudflare > astro dev 🚀 astro v2.1.3 started in 45ms ┃ Local http://localhost:3000/ ┃ Network use --host to expose cloudflare-pages-plugin-trpc doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix. { origin: 'http://localhost:3000' } (node:61648) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time (Use `node --trace-warnings ...` to show where the warning was created) (node:61648) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. 18:48:04 [vite] Error when evaluating SSR module /Users/zen/Desktop/trpc-astro-cloudflare/src/pages/api/trpc/[trpc].ts: failed to import "cloudflare-pages-plugin-trpc" error Unexpected token 'export' /Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/cloudflare-pages-plugin-trpc@0.3.2_@trpc+server@10.16.0/node_modules/cloudflare-pages-plugin-trpc/dist/index.js:820 export { ^^^^^^ SyntaxError: Unexpected token 'export' at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1088:15) at Module._compile (node:internal/modules/cjs/loader:1123:27) at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) at Module.load (node:internal/modules/cjs/loader:1037:32) at Module._load (node:internal/modules/cjs/loader:878:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29) at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) error Unexpected token < in JSON at position 0 File: /Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/transformResult-6fb67924.mjs:13:16 Code: 12 | } > 13 | return new TRPCClientError(cause.message, { | ^ 14 | ...opts, 15 | cause, 16 | result: null Stacktrace: TRPCClientError: Unexpected token < in JSON at position 0 at TRPCClientError.from (file:///Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/transformResult-6fb67924.mjs:13:16) at file:///Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/links/httpBatchLink.mjs:200:64 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Cause: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at Response.json (node:internal/deps/undici/undici:6160:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { origin: 'http://localhost:3000' } error Unexpected token 'export' /Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/cloudflare-pages-plugin-trpc@0.3.2_@trpc+server@10.16.0/node_modules/cloudflare-pages-plugin-trpc/dist/index.js:820 export { ^^^^^^ SyntaxError: Unexpected token 'export' at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1088:15) at Module._compile (node:internal/modules/cjs/loader:1123:27) at Module._extensions..js (node:internal/modules/cjs/loader:1213:10) at Module.load (node:internal/modules/cjs/loader:1037:32) at Module._load (node:internal/modules/cjs/loader:878:12) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29) at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Promise.all (index 0) error Unexpected token < in JSON at position 0 File: /Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/transformResult-6fb67924.mjs:13:16 Code: 12 | } > 13 | return new TRPCClientError(cause.message, { | ^ 14 | ...opts, 15 | cause, 16 | result: null Stacktrace: TRPCClientError: Unexpected token < in JSON at position 0 at TRPCClientError.from (file:///Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/transformResult-6fb67924.mjs:13:16) at file:///Users/zen/Desktop/trpc-astro-cloudflare/node_modules/.pnpm/@trpc+client@10.16.0_@trpc+server@10.16.0/node_modules/@trpc/client/dist/links/httpBatchLink.mjs:200:64 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Cause: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at Response.json (node:internal/deps/undici/undici:6160:23) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is not yet working. Building (
pnpm dev) gives an error: