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

Could not resolve "path" when building for Cloudflare Workers #113

Closed
sergeysova opened this issue Jun 28, 2024 · 0 comments
Closed

Could not resolve "path" when building for Cloudflare Workers #113

sergeysova opened this issue Jun 28, 2024 · 0 comments

Comments

@sergeysova
Copy link
Contributor

sergeysova commented Jun 28, 2024

Using:

pnpm vite build
pnpm wrangler build
 ⛅️ wrangler 3.62.0
-------------------


✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/telefunc@0.1.74_@babel+core@7.23.9_@babel+parser@7.24.5_@babel+types@7.24.5_react-streaming@0_3t7m6eqtjjvdb6ys45f7c5hbhi/node_modules/telefunc/dist/cjs/node/server/runTelefunc/loadTelefuncFilesFromConfig.js:8:23:
      8 │ const path_1 = require("path");
        ╵                        ~~~~~~

  The package "path" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.


✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/telefunc@0.1.74_@babel+core@7.23.9_@babel+parser@7.24.5_@babel+types@7.24.5_react-streaming@0_3t7m6eqtjjvdb6ys45f7c5hbhi/node_modules/telefunc/dist/cjs/node/server/serverConfig.js:4:23:
      4 │ const path_1 = require("path");
        ╵                        ~~~~~~

  The package "path" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.


✘ [ERROR] Could not resolve "path"

    node_modules/.pnpm/telefunc@0.1.74_@babel+core@7.23.9_@babel+parser@7.24.5_@babel+types@7.24.5_react-streaming@0_3t7m6eqtjjvdb6ys45f7c5hbhi/node_modules/telefunc/dist/cjs/utils/getOutDirs.js:9:39:
      9 │ const path_1 = __importDefault(require("path"));
        ╵                                        ~~~~~~

  The package "path" wasn't found on the file system but is built into node.
  Add "node_compat = true" to your wrangler.toml file and make sure to prefix the module name with "node:" to enable Node.js compatibility.

I use:

vike 0.4.177
vite 5.2.11

Possible solution is to replace all node imports to prefixed. When I actually replaced in node_modules it works correctly

sergeysova added a commit to ScreenStory/telefunc that referenced this issue Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant