RSSAmplifier

Skill Issue Dev | Dax the Dev · Apr 1, 2026

ESM crypto import in Vite — stop using `require()`

0
Sign in to vote or save

This page did not load. You can still read it on the original site — the toolbar below keeps your place in the directory.

Vite 5 with "type": "module" rejects require("crypto") . Symptom: dev server boots, prod build silently drops the crypto import, runtime crashes on first signature verify. No warning at build time. Fix: import { createHash } from "node:crypto" (the node: prefix matters too — without it, the bundler tries to find a polyfill called "crypto" and ships ~120KB of extra code). The node: prefix tells…

Read on github.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.