Repository navigation
Rollup Error: "randomUUID" is not exported by "__vite-browser-external" #1569
Replies: 2 comments 1 reply
|
I'm also having prob with this |
|
The importer in the error is the important clue: There is a larger compatibility problem than I checked a minimal Vite 4.4.9 build on Linux/Node 24.22.1 with that package:
That shim was a diagnostic experiment, not a solution. The original installed For ordinary browser HTTP requests, remove async function getData(url) {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response.json();
}This small replacement built without the native dependencies; mocked-response checks verified successful JSON and rejection of a non-OK response. I have not tested your target endpoint or extension permissions. Browser fetch also does not reproduce the package's custom TLS-client behavior. If that functionality is essential, it must run in a suitable Node/native service, not inside the browser bundle. Vite's documentation explains the browser-external diagnostic and why Node modules are not automatically polyfilled. |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
npm run buildis failing with Error: "randomUUID" is not exported by "__vite-browser-external"Here is my vite.config.ts
Expected Behavior
to build properly
Actual Behavior
Additional Information
Reproduction
tsc && vite build
Steps to reproduce
npm install
npm run build
System Info
Used Package Manager
npm
Logs
"randomUUID" is not exported by "__vite-browser-external", imported by "node_modules/tls-client/dist/esm/sessions.js".
file: /Users/ishandutta2007/Documents/Projects/X/node_modules/tls-client/dist/esm/sessions.js:5:9
3: import { Response } from './response';
4: import { CookieJar } from 'tough-cookie';
5: import { randomUUID } from 'crypto';
^
6: import { version, } from './version';
7: class Session {
error during build:
RollupError: "randomUUID" is not exported by "__vite-browser-external", imported by "node_modules/tls-client/dist/esm/sessions.js".
at error (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
at Module.error (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13716:16)
at Module.traceVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:14146:29)
at ModuleScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:12589:39)
at ChildScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
at ClassBodyScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
at ChildScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
at FunctionScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
at ChildScope.findVariable (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:7124:38)
at Identifier.bind (file:///Users/ishandutta2007/Documents/Projects/X/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:8309:40)
Validations
All reactions