Repository navigation
fix: vite.config.ts の __dirname を import.meta.dirname に - #192
Merged
Merged
Conversation
The package is "type": "module", so __dirname is not defined in the config; it worked only because Vite's bundled config loader supplies it. With --configLoader runner (native ESM) vitest and vite build stopped at startup with ReferenceError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
CODEX VERDICT: LGTM
Reviewed SHA: Mutation sweep: not run; no mutation is proposed. FINDINGS COMPLETE: I read every hunk of the diff and this is every finding I have. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces
__dirnamewithimport.meta.dirnamein the three placesvite.config.tsuses it, the entry points of the library build.The package is
"type": "module", so__dirnameis not defined in the config. It worked only because Vite's default (bundling) config loader fills it in. Loaded as native ESM (--configLoader runner),vitestandvite buildstopped at startup withReferenceError: __dirname is not defined. This is what had kept Codex's environment from running vitest.Items to Confirm
yarn buildbefore and after the change, and the hashes of every file underdist/compared: all identical.npx vitest run --configLoader runnerpasses, andnpx vite build --configLoader runnersucceeds. Both failed at startup before.yarn test(the default loader),yarn lintandyarn typecheckpass, andnpx vite(the demo's dev server) answers 200.import.meta.dirnameneeds Node 20.11 or later;enginesis already>=22.vite.config.tsis not intsconfig.json'sinclude, and@types/nodeis not installed. So this file's types are not checked, as with__dirnamebefore.User Prompt
__dirnameworth fixing? If so, go ahead.🤖 Generated with Claude Code
work in GUIChatPluginSpreadsheet