What
desktop/package.json declares no "type", so every .ts/.js file in the package is loaded as CommonJS by default. Two tools already complain, for the same reason.
Vite 8, on every dev-server start and build (surfaced by #137):
(!) Your Vite config uses features that are unsupported by `configLoader: 'native'`,
which is planned to become the default in a future major version of Vite:
- ESM syntax in a file loaded as CommonJS (vite.config.ts:1:1).
Use a `.mjs` extension or set `"type": "module"` in the closest package.json
Set `VITE_CONFIG_NATIVE_IGNORE_WARNING=true` to suppress this warning.
oxlint, on every npm run lint:
(node:39406) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of
file:///.../desktop/tools/oxlint/anti-slop/index.ts is not specified and it
doesn't parse as CommonJS. Reparsing as ES module because module syntax was
detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to .../desktop/package.json.
Nothing is broken today — both tools fall back correctly. The vite one is a deprecation notice with a stated end date: when configLoader: 'native' becomes the default in a future vite major, the fallback goes away.
Why it is not a one-line change
vite.config.ts uses __dirname, which does not exist in an ES module:
root: resolve(__dirname, 'renderer'),
build: { outDir: resolve(__dirname, 'dist/renderer'), … }
So adding "type": "module" requires replacing it with
dirname(fileURLToPath(import.meta.url)), and then checking every other file the package loads as CommonJS — .eslintrc.cjs is already explicitly .cjs and would be fine, but tools/oxlint/anti-slop/index.ts, scripts/stamp-release.js (which uses require), and anything else executed by node rather than bundled all need auditing.
Options
- Add
"type": "module" and fix the fallout. Correct long-term, and removes both warnings. Needs the __dirname replacement plus a sweep of node-executed files.
- Rename
vite.config.ts → vite.config.mts. Silences the vite warning specifically, with no package-wide change. Leaves the oxlint warning.
- Set
VITE_CONFIG_NATIVE_IGNORE_WARNING=true. Suppresses the message without addressing anything — only worth it as a deliberate, commented decision.
Option 1 is the real fix. Worth doing before the vite major that flips the default, rather than under time pressure when it lands.
Verification note
Whatever lands must be checked against the dev server, not just vite build — the ferry-dev-csp plugin in vite.config.ts rewrites the meta CSP so @vitejs/plugin-react can inject its refresh preamble, and if the config fails to load the dev window renders nothing at all.
What
desktop/package.jsondeclares no"type", so every.ts/.jsfile in the package is loaded as CommonJS by default. Two tools already complain, for the same reason.Vite 8, on every dev-server start and build (surfaced by #137):
oxlint, on every
npm run lint:Nothing is broken today — both tools fall back correctly. The vite one is a deprecation notice with a stated end date: when
configLoader: 'native'becomes the default in a future vite major, the fallback goes away.Why it is not a one-line change
vite.config.tsuses__dirname, which does not exist in an ES module:So adding
"type": "module"requires replacing it withdirname(fileURLToPath(import.meta.url)), and then checking every other file the package loads as CommonJS —.eslintrc.cjsis already explicitly.cjsand would be fine, buttools/oxlint/anti-slop/index.ts,scripts/stamp-release.js(which usesrequire), and anything else executed by node rather than bundled all need auditing.Options
"type": "module"and fix the fallout. Correct long-term, and removes both warnings. Needs the__dirnamereplacement plus a sweep of node-executed files.vite.config.ts→vite.config.mts. Silences the vite warning specifically, with no package-wide change. Leaves the oxlint warning.VITE_CONFIG_NATIVE_IGNORE_WARNING=true. Suppresses the message without addressing anything — only worth it as a deliberate, commented decision.Option 1 is the real fix. Worth doing before the vite major that flips the default, rather than under time pressure when it lands.
Verification note
Whatever lands must be checked against the dev server, not just
vite build— theferry-dev-cspplugin invite.config.tsrewrites the meta CSP so@vitejs/plugin-reactcan inject its refresh preamble, and if the config fails to load the dev window renders nothing at all.