[commonjs--resolver] Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
Hi,
I have a bug and since I am not an expert on building and compiling I am not sure if this is a nitro, vite, tanstack start or a skill issue.
I previously had nitro 3.0.1-alpha.1 which worked. The bug occures with nightly
nitro:
specifier: npm:nitro-nightly@latest
version: nitro-nightly@3.0.1-20260227-181935-bfbb207c(@azure/identity@4.13.0)(chokidar@5.0.0)(dotenv@17.2.3)(drizzle-orm@0.44.7(@neondatabase/serverless@1.0.2)(@opentelemetry/api@1.9.0)(@types/pg@8.16.0)(kysely@0.28.9)(pg@8.16.3))(giget@2.0.0)(ioredis@5.9.1)(jiti@2.6.1)(lru-cache@11.2.4)(mongodb@6.16.0)(vite@7.3.1(@types/node@25.2.3)(jiti@2.6.1)(lightningcss@1.30.2)(sass@1.77.4)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))(xml2js@0.6.2)
This is my vite config at the moment:
export default defineConfig(async ({ mode: _mode }: ConfigEnv) => {
// const isDevelopment = mode === 'development';
return {
server: {
port: 3000,
},
build: {
chunkSizeWarningLimit: 1000,
sourcemap: false,
},
plugins: [
// devtools({
// eventBusConfig: {
// debug: isDevelopment,
// },
// enhancedLogs: {
// enabled: isDevelopment,
// },
// injectSource: {
// enabled: isDevelopment,
// },
// }),
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide',
strategy: ['cookie', 'baseLocale'],
cookieName: 'language',
outputStructure:
process.env.NODE_ENV === 'development'
? 'locale-modules'
: 'message-modules',
emitTsDeclarations: true,
}),
tsConfigPaths({
projects: ['./tsconfig.json'],
}),
tanstackStart(),
nitro(),
// Inspect(),
viteReact(),
// visualizer({ filename: 'stats.html', template: 'treemap' }),
// This has to be the last plugin
sentryTanstackStart({
org: 'abc-inc',
project: 'abc',
authToken: process.env.SENTRY_AUTH_TOKEN,
}),
],
};
});
Other versions:
"vite": "^7.0.6",
"@tanstack/react-router": "^1.160.0",
"@tanstack/react-router-ssr-query": "^1.160.0",
"@tanstack/react-start": "^1.160.0",
"@vitejs/plugin-react": "^5.1.0",
"rollup-plugin-visualizer": "^6.0.5",
"typescript": "^5.9.2",
"vite-plugin-inspect": "^11.3.3",
"vite-tsconfig-paths": "6.1.1"
### Reproduction
I can try to provide one if needed or give repo access
### Describe the bug
I run the build with the nightly and run into the following error:
✔ Traced 18 dependencies (260 files) in 1980ms. 1:38:32 AM
ℹ Ensure your production environment matches the builder OS and architecture (darwin-arm64) to avoid native module issues. 1:38:32 AM
✔ Traced 18 dependencies (260 files) in 1981ms. 1:38:32 AM
ℹ Ensure your production environment matches the builder OS and architecture (darwin-arm64) to avoid native module issues. 1:38:32 AM
✗ Build failed in 3m 9s
error during build:
[commonjs--resolver] ../../node_modules/fsevents/fsevents.node (1:0): Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)
file: /Users/jofflin/Development/nono/nono-monorepo/node_modules/fsevents/fsevents.node:1:0 (/Users/jofflin/Development/nono/nono-monorepo/node_modules/chokidar/index.js)
1: ����@<�
��...
^
4
h���/System/Library/Frameworks/CoreFoundation.framework/Versions...
3: ���H��1�H���L���L���H�����L�E�L��H��1�����uH�E�H�[A^A_]��}f.�UH��AWAVSPI��H��I��H�H...
at getRollupError (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/parseAst.js:401:41)
at ParseError.initialise (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/node-entry.js:14534:28)
at convertNode (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/node-entry.js:16418:10)
at convertProgram (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/node-entry.js:15658:12)
at Module.setSource (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/node-entry.js:17418:24)
at async ModuleLoader.addModuleSource (file:///Users/jofflin/Development/nono/nono-monorepo/node_modules/rollup/dist/es/shared/node-entry.js:21497:13)
ELIFECYCLE Command failed with exit code 1.
### Additional context
_No response_
### Logs
```sh
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the production build with the reported Nitro nightly version and the shown Vite configuration. Trace the import from node_modules/chokidar/index.js to node_modules/fsevents/fsevents.node and inspect the CommonJS resolver error. Done means the reported build completes without attempting to parse the native binary as JavaScript.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rollup, typescript, vite
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100