I get this error when trying to build:
I get this error:
X [ERROR] Could not resolve "http"
node_modules/tiny-json-http/dist.js:9:23:
9 │ var http = require("http");
╵ ~~~~~~
The package "http" 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.
X [ERROR] Could not resolve "https"
node_modules/tiny-json-http/dist.js:10:24:
10 │ var https = require("https");
╵ ~~~~~~~
The package "https" 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.
X [ERROR] Could not resolve "path"
node_modules/tiny-json-http/dist.js:354:26:
354 │ var extname = require("path").extname;
╵ ~~~~~~
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.
X [ERROR] Could not resolve "fs"
node_modules/tiny-json-http/dist.js:603:21:
603 │ var fs = require("fs");
╵ ~~~~
The package "fs" 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.
error Could not resolve "http"
File:
node_modules/tiny-json-http/dist.js:9:23
Code:
8 | "_read.js"(exports2, module2) {
> 9 | var http = require("http");
| ^
10 | var https = require("https");
11 | var url = require("url");
12 | var qs = require("querystring");
Stacktrace:
Error: Build failed with 4 errors:
node_modules/tiny-json-http/dist.js:9:23: ERROR: Could not resolve "http"
node_modules/tiny-json-http/dist.js:10:24: ERROR: Could not resolve "https"
node_modules/tiny-json-http/dist.js:354:26: ERROR: Could not resolve "path"
node_modules/tiny-json-http/dist.js:603:21: ERROR: Could not resolve "fs"
at failureErrorWithLog (E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:1650:15)
at E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:1059:25
at E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:1004:52
at buildResponseToResult (E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:1057:7)
at E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:1086:16
at responseCallbacks.<computed> (E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:703:9)
at handleIncomingPacket (E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:763:9)
at Socket.readFromStdout (E:\Github\GDPT-ANOMA\node_modules\esbuild\lib\main.js:679:7)
at Socket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Readable.push (node:internal/streams/readable:234:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
This error only occurs when building the project. It does not occur when running yarn run dev. I am trying to run Decap CMS and deploying it through cloudflare pages.