Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't work with jsc8 #133

Closed
2 tasks done
ladieman217 opened this issue Dec 18, 2021 · 3 comments
Closed
2 tasks done

Can't work with jsc8 #133

ladieman217 opened this issue Dec 18, 2021 · 3 comments
Labels
enhancement New feature or request pages Relating to Pages

Comments

@ladieman217
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Description

Can't work with jsc8 in cloudflare pages and functions

Steps to Reproduce

  1. clone this repo https://github.com/YUFENGWANG/sticker.ink
  2. install deps and run npm run dev
  3. install wrangler beta npm install -g wrangler@beta
  4. Open a new terminal run wrangler pages dev ./dist --proxy=3000

Current Behavior

Build failed, and it says

image

Expected Behavior

worker scripts in function folder built correctly

Failure Logs

Compiling worker to "/var/folders/hh/2zx_j24n4z7gntlh9yq3z4b00000gn/T/functionsWorker.js"
✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/[email protected]/node_modules/jsc8/lib/cjs/util/joinPath.web.js:3:21:
      3 │ var path_1 = require("path");~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

/Users/wenhu/.npm/_npx/8c55f4bc76fffd7b/node_modules/esbuild/lib/main.js:1493
  let error = new Error(`${text}${summary}`);

Context

  • C8 Version: ^0.16.3
@threepointone threepointone added enhancement New feature or request pages Relating to Pages labels Dec 19, 2021
@threepointone
Copy link
Contributor

We have an issue tracking polyfilling libraries that assume a node environment (#101) which we'll get to in q1.

@ladieman217
Copy link
Author

Great job, looking forward to it.

@threepointone
Copy link
Contributor

We landed initial support for node compatibility, either by adding node_compat = true in wrangler.toml, or by passing --node-compat in the command line, which should resolve this specific issue. Closing this issue, but lemme know if you face any further problems.

GregBrimble pushed a commit that referenced this issue Feb 8, 2024
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
GregBrimble pushed a commit that referenced this issue Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pages Relating to Pages
Projects
None yet
Development

No branches or pull requests

2 participants