-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[fix] set platform to neutral when calling esbuild #8083
Conversation
🦋 Changeset detectedLatest commit: 0f94998 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
I believe this change still makes sense even after the other fix. esbuild should not assume browser by itself, changing the default from 'neutrail' to 'browser' was done in esbuild 0.16 which we recently updated to to align with vite-4. Like discussed elsewhere it should be applied to all adapters using esbuild, not just cf's |
Is this change applied to |
Yes, this PR does affect Vercel. Can you give more details such as the error message and library that's failing and ideally provide a project that reproduces the failure? |
Yes, sure! I just haven't had the time to create a bug ticket 😞 The error looks like that (Using node 18 with vercel, if that matters)Error log✘ [ERROR] Could not resolve "stream"
--
10:27:57.167 |
10:27:57.167 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:1:19:
10:27:57.167 | 1 │ import Stream from 'stream';
10:27:57.167 | ╵ ~~~~~~~~
10:27:57.167 |
10:27:57.167 | The package "stream" 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.
10:27:57.168 |
10:27:57.168 | ✘ [ERROR] Could not resolve "http"
10:27:57.168 |
10:27:57.168 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:2:17:
10:27:57.169 | 2 │ import http from 'http';
10:27:57.169 | ╵ ~~~~~~
10:27:57.169 |
10:27:57.169 | 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.
10:27:57.169 |
10:27:57.169 | ✘ [ERROR] Could not resolve "url"
10:27:57.169 |
10:27:57.169 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:3:16:
10:27:57.169 | 3 │ import Url from 'url';
10:27:57.169 | ╵ ~~~~~
10:27:57.170 |
10:27:57.170 | The package "url" 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.
10:27:57.170 |
10:27:57.170 | ✘ [ERROR] Could not resolve "https"
10:27:57.170 |
10:27:57.170 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:5:18:
10:27:57.170 | 5 │ import https from 'https';
10:27:57.170 | ╵ ~~~~~~~
10:27:57.170 |
10:27:57.170 | 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.
10:27:57.170 |
10:27:57.170 | ✘ [ERROR] Could not resolve "zlib"
10:27:57.170 |
10:27:57.170 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:6:17:
10:27:57.170 | 6 │ import zlib from 'zlib';
10:27:57.170 | ╵ ~~~~~~
10:27:57.170 |
10:27:57.170 | The package "zlib" 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.
10:27:57.170 |
10:27:57.199 | ✘ [ERROR] Could not resolve "util"
10:27:57.199 |
10:27:57.199 | node_modules/.pnpm/object-inspect@1.12.2/node_modules/object-inspect/util.inspect.js:1:25:
10:27:57.199 | 1 │ module.exports = require('util').inspect;
10:27:57.199 | ╵ ~~~~~~
10:27:57.199 |
10:27:57.199 | The package "util" 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.
10:27:57.200 |
10:27:57.203 | ✘ [ERROR] Could not resolve "util"
10:27:57.203 |
10:27:57.203 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketServer.js:19:19:
10:27:57.203 | 19 │ var util = require('util');
10:27:57.204 | ╵ ~~~~~~
10:27:57.204 |
10:27:57.204 | The package "util" 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.
10:27:57.204 |
10:27:57.204 | ✘ [ERROR] Could not resolve "events"
10:27:57.204 |
10:27:57.205 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketServer.js:21:27:
10:27:57.205 | 21 │ var EventEmitter = require('events').EventEmitter;
10:27:57.205 | ╵ ~~~~~~~~
10:27:57.205 |
10:27:57.205 | The package "events" 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.
10:27:57.206 |
10:27:57.206 | ✘ [ERROR] Could not resolve "util"
10:27:57.206 |
10:27:57.206 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:19:19:
10:27:57.206 | 19 │ var util = require('util');
10:27:57.206 | ╵ ~~~~~~
10:27:57.206 |
10:27:57.207 | The package "util" 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.
10:27:57.207 |
10:27:57.207 | ✘ [ERROR] Could not resolve "events"
10:27:57.207 |
10:27:57.207 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:20:27:
10:27:57.207 | 20 │ var EventEmitter = require('events').EventEmitter;
10:27:57.207 | ╵ ~~~~~~~~
10:27:57.207 |
10:27:57.207 | The package "events" 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.
10:27:57.207 |
10:27:57.207 | ✘ [ERROR] Could not resolve "http"
10:27:57.207 |
10:27:57.207 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:21:19:
10:27:57.207 | 21 │ var http = require('http');
10:27:57.207 | ╵ ~~~~~~
10:27:57.208 |
10:27:57.208 | 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.
10:27:57.208 |
10:27:57.208 | ✘ [ERROR] Could not resolve "https"
10:27:57.208 |
10:27:57.208 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:22:20:
10:27:57.208 | 22 │ var https = require('https');
10:27:57.208 | ╵ ~~~~~~~
10:27:57.208 |
10:27:57.208 | 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.
10:27:57.208 |
10:27:57.208 | ✘ [ERROR] Could not resolve "url"
10:27:57.208 |
10:27:57.208 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:23:18:
10:27:57.209 | 23 │ var url = require('url');
10:27:57.209 | ╵ ~~~~~
10:27:57.209 |
10:27:57.209 | The package "url" 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.
10:27:57.209 |
10:27:57.209 | ✘ [ERROR] Could not resolve "crypto"
10:27:57.209 |
10:27:57.209 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketClient.js:24:21:
10:27:57.209 | 24 │ var crypto = require('crypto');
10:27:57.209 | ╵ ~~~~~~~~
10:27:57.209 |
10:27:57.209 | The package "crypto" 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.
10:27:57.209 |
10:27:57.209 | ✘ [ERROR] Could not resolve "util"
10:27:57.209 |
10:27:57.209 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketConnection.js:17:19:
10:27:57.209 | 17 │ var util = require('util');
10:27:57.210 | ╵ ~~~~~~
10:27:57.210 |
10:27:57.210 | The package "util" 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.
10:27:57.210 |
10:27:57.210 | ✘ [ERROR] Could not resolve "events"
10:27:57.210 |
10:27:57.210 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketConnection.js:19:27:
10:27:57.210 | 19 │ var EventEmitter = require('events').EventEmitter;
10:27:57.210 | ╵ ~~~~~~~~
10:27:57.210 |
10:27:57.210 | The package "events" 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.
10:27:57.210 |
10:27:57.211 | ✘ [ERROR] Could not resolve "crypto"
10:27:57.211 |
10:27:57.211 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRequest.js:17:21:
10:27:57.211 | 17 │ var crypto = require('crypto');
10:27:57.211 | ╵ ~~~~~~~~
10:27:57.211 |
10:27:57.211 | The package "crypto" 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.
10:27:57.211 |
10:27:57.212 | ✘ [ERROR] Could not resolve "util"
10:27:57.212 |
10:27:57.212 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRequest.js:18:19:
10:27:57.212 | 18 │ var util = require('util');
10:27:57.212 | ╵ ~~~~~~
10:27:57.212 |
10:27:57.212 | The package "util" 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.
10:27:57.212 |
10:27:57.212 | ✘ [ERROR] Could not resolve "url"
10:27:57.212 |
10:27:57.212 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRequest.js:19:18:
10:27:57.212 | 19 │ var url = require('url');
10:27:57.212 | ╵ ~~~~~
10:27:57.212 |
10:27:57.212 | The package "url" 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.
10:27:57.212 |
10:27:57.212 | ✘ [ERROR] Could not resolve "events"
10:27:57.212 |
10:27:57.213 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRequest.js:20:27:
10:27:57.213 | 20 │ var EventEmitter = require('events').EventEmitter;
10:27:57.213 | ╵ ~~~~~~~~
10:27:57.213 |
10:27:57.213 | The package "events" 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.
10:27:57.213 |
10:27:57.213 | ✘ [ERROR] Could not resolve "fs"
10:27:57.213 |
10:27:57.213 | node_modules/.pnpm/node-gyp-build@4.5.0/node_modules/node-gyp-build/index.js:1:17:
10:27:57.213 | 1 │ var fs = require('fs')
10:27:57.213 | ╵ ~~~~
10:27:57.213 |
10:27:57.213 | 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.
10:27:57.213 |
10:27:57.213 | ✘ [ERROR] Could not resolve "path"
10:27:57.213 |
10:27:57.213 | node_modules/.pnpm/node-gyp-build@4.5.0/node_modules/node-gyp-build/index.js:2:19:
10:27:57.213 | 2 │ var path = require('path')
10:27:57.213 | ╵ ~~~~~~
10:27:57.213 |
10:27:57.213 | 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.
10:27:57.213 |
10:27:57.214 | ✘ [ERROR] Could not resolve "os"
10:27:57.214 |
10:27:57.214 | node_modules/.pnpm/node-gyp-build@4.5.0/node_modules/node-gyp-build/index.js:3:17:
10:27:57.214 | 3 │ var os = require('os')
10:27:57.214 | ╵ ~~~~
10:27:57.214 |
10:27:57.214 | The package "os" 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.
10:27:57.214 |
10:27:57.214 | ✘ [ERROR] Could not resolve "events"
10:27:57.214 |
10:27:57.214 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/utils.js:10:12:
10:27:57.214 | 10 │ require('events').EventEmitter.listenerCount \|\|
10:27:57.214 | ╵ ~~~~~~~~
10:27:57.214 |
10:27:57.214 | The package "events" 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.
10:27:57.214 |
10:27:57.214 | ✘ [ERROR] Could not resolve "tty"
10:27:57.214 |
10:27:57.214 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:5:18:
10:27:57.214 | 5 │ var tty = require('tty');
10:27:57.214 | ╵ ~~~~~
10:27:57.215 |
10:27:57.215 | The package "tty" 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.
10:27:57.215 |
10:27:57.215 | ✘ [ERROR] Could not resolve "util"
10:27:57.215 |
10:27:57.215 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:6:19:
10:27:57.215 | 6 │ var util = require('util');
10:27:57.215 | ╵ ~~~~~~
10:27:57.215 |
10:27:57.215 | The package "util" 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.
10:27:57.215 |
10:27:57.215 | ✘ [ERROR] Could not resolve "fs"
10:27:57.215 |
10:27:57.215 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:186:23:
10:27:57.215 | 186 │ var fs = require('fs');
10:27:57.216 | ╵ ~~~~
10:27:57.216 |
10:27:57.216 | 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.
10:27:57.216 |
10:27:57.216 | ✘ [ERROR] Could not resolve "net"
10:27:57.216 |
10:27:57.216 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:193:24:
10:27:57.216 | 193 │ var net = require('net');
10:27:57.216 | ╵ ~~~~~
10:27:57.216 |
10:27:57.216 | The package "net" 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.
10:27:57.216 |
10:27:57.217 | ✘ [ERROR] Could not resolve "buffer"
10:27:57.217 |
10:27:57.217 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/vendor/FastBufferList.js:7:21:
10:27:57.217 | 7 │ var Buffer = require('buffer').Buffer;
10:27:57.217 | ╵ ~~~~~~~~
10:27:57.217 |
10:27:57.217 | The package "buffer" 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.
10:27:57.217 |
10:27:57.217 | ✘ [ERROR] Could not resolve "events"
10:27:57.217 |
10:27:57.217 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/vendor/FastBufferList.js:8:27:
10:27:57.217 | 8 │ var EventEmitter = require('events').EventEmitter;
10:27:57.217 | ╵ ~~~~~~~~
10:27:57.217 |
10:27:57.217 | The package "events" 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.
10:27:57.217 |
10:27:57.217 | ✘ [ERROR] Could not resolve "util"
10:27:57.217 |
10:27:57.217 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/vendor/FastBufferList.js:191:8:
10:27:57.217 | 191 │ require('util').inherits(BufferList, EventEmitter);
10:27:57.217 | ╵ ~~~~~~
10:27:57.218 |
10:27:57.218 | The package "util" 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.
10:27:57.218 |
10:27:57.218 | ✘ [ERROR] Could not resolve "util"
10:27:57.218 |
10:27:57.218 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRouter.js:18:19:
10:27:57.218 | 18 │ var util = require('util');
10:27:57.218 | ╵ ~~~~~~
10:27:57.218 |
10:27:57.218 | The package "util" 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.
10:27:57.218 |
10:27:57.218 | ✘ [ERROR] Could not resolve "events"
10:27:57.218 |
10:27:57.218 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRouter.js:19:27:
10:27:57.218 | 19 │ var EventEmitter = require('events').EventEmitter;
10:27:57.218 | ╵ ~~~~~~~~
10:27:57.218 |
10:27:57.218 | The package "events" 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.
10:27:57.218 |
10:27:57.218 | ✘ [ERROR] Could not resolve "util"
10:27:57.218 |
10:27:57.218 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRouterRequest.js:17:19:
10:27:57.219 | 17 │ var util = require('util');
10:27:57.219 | ╵ ~~~~~~
10:27:57.219 |
10:27:57.219 | The package "util" 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.
10:27:57.219 |
10:27:57.219 | ✘ [ERROR] Could not resolve "events"
10:27:57.219 |
10:27:57.219 | node_modules/.pnpm/websocket@1.0.34/node_modules/websocket/lib/WebSocketRouterRequest.js:18:27:
10:27:57.219 | 18 │ var EventEmitter = require('events').EventEmitter;
10:27:57.219 | ╵ ~~~~~~~~
10:27:57.219 |
10:27:57.219 | The package "events" 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.
10:27:57.219 |
10:27:57.317 | error during build:
10:27:57.317 | Error: Build failed with 35 errors:
10:27:57.317 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:5:18: ERROR: Could not resolve "tty"
10:27:57.317 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:6:19: ERROR: Could not resolve "util"
10:27:57.317 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:186:23: ERROR: Could not resolve "fs"
10:27:57.317 | node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js:193:24: ERROR: Could not resolve "net"
10:27:57.317 | node_modules/.pnpm/node-fetch@2.6.7/node_modules/node-fetch/lib/index.mjs:1:19: ERROR: Could not resolve "stream"
10:27:57.317 | ...
10:27:57.318 | at failureErrorWithLog (/vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:1591:15)
10:27:57.318 | at /vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:1047:28
10:27:57.318 | at /vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:992:67
10:27:57.318 | at buildResponseToResult (/vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:1045:7)
10:27:57.318 | at /vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:1157:14
10:27:57.318 | at responseCallbacks.<computed> (/vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:694:9)
10:27:57.318 | at handleIncomingPacket (/vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:749:9)
10:27:57.318 | at Socket.readFromStdout (/vercel/path0/node_modules/.pnpm/esbuild@0.16.4/node_modules/esbuild/lib/main.js:670:7)
10:27:57.318 | at Socket.emit (node:events:513:28)
10:27:57.318 | at Socket.emit (node:domain:489:12)
10:27:57.360 | Error: Command "vite build" exited with 1 I have pinned my version to
|
This reverts commit ee7cd45.
closes #8082