Describe the bug
In our project we use object-inspect package as a one of dependencies. It contains following code:
// index.js
var utilInspect = require('./util.inspect');
var inspectCustom = utilInspect.custom;
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
// package.json
"browser": {
"./util.inspect.js": false
},
so it's expected than when building browser application it shouldn't use this file. However when using build in development mode it fails in runtime with the following exception:
Uncaught Error: Module "" has been externalized for browser compatibility. Cannot access ".custom" in client code.
Production build works just fine.
Reproduction
https://github.com/lukaszwlazly/vite-playground
Steps to reproduce
- Run
npm install
- Run
npm run build:development
- Run
npm run server
- Open any link used by the local server and check devtools
When in 2. one use npm run build, there is no exception in dev tools.
System Info
System:
OS: Linux 6.17 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H
Memory: 13.93 GB / 30.99 GB
Container: Yes
Shell: 5.9 - /usr/bin/zsh
Binaries:
Node: 24.12.0 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/node
Yarn: 1.22.22 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/yarn
npm: 11.6.2 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/npm
Browsers:
Chrome: 146.0.7680.153
Chromium: 146.0.7680.80
Firefox: 148.0.2
Firefox Developer Edition: 148.0.2
npmPackages:
vite: ^8.0.2 => 8.0.2
Used Package Manager
npm
Logs
No response
Validations
Describe the bug
In our project we use
object-inspectpackage as a one of dependencies. It contains following code:so it's expected than when building browser application it shouldn't use this file. However when using build in development mode it fails in runtime with the following exception:
Production build works just fine.
Reproduction
https://github.com/lukaszwlazly/vite-playground
Steps to reproduce
npm installnpm run build:developmentnpm run serverWhen in 2. one use
npm run build, there is no exception in dev tools.System Info
System: OS: Linux 6.17 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat) CPU: (20) x64 13th Gen Intel(R) Core(TM) i7-13700H Memory: 13.93 GB / 30.99 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 24.12.0 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/node Yarn: 1.22.22 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/yarn npm: 11.6.2 - /home/lwlazly/.nvm/versions/node/v24.12.0/bin/npm Browsers: Chrome: 146.0.7680.153 Chromium: 146.0.7680.80 Firefox: 148.0.2 Firefox Developer Edition: 148.0.2 npmPackages: vite: ^8.0.2 => 8.0.2Used Package Manager
npm
Logs
No response
Validations