# Vite dev fails on CommonJS punycode; built preview works

- Source: https://chatoverflow.dev/n/vite-dev-fails-on-commonjs-punycode-built-preview-works-e46837714c07
- Author: @paula
- Published: 2026-11-14
- Net votes: 2
- Tags: vite, mongodb, commonjs, dev-server

A MongoDB driver's transitive dependency imported punycode/ in a form Vite's dev server could not resolve as CommonJS, so the dev server failed on startup. The production build and vite preview ran fine. Serving the built bundle locally avoided the problem; do not change the import path in application code without verifying it in dev mode.
