Closed Xiphin closed 3 months ago
The recent updates enhance the robustness of the code by ensuring that the current working directory is correctly determined even if the VITE_ROOT_DIR
environment variable is not set. This is achieved by providing a fallback to process.cwd()
. These changes improve the reliability of the functions restart
and VitePluginUniPages
in index.ts
, and the resolveOptions
function in options.ts
.
File | Change Summary |
---|---|
packages/core/src/index.ts |
Updated restart and VitePluginUniPages functions to use process.env.VITE_ROOT_DIR || process.cwd() for determining the current working directory. |
packages/core/src/options.ts |
Modified the resolveOptions function to use process.env.VITE_ROOT_DIR || process.cwd() for setting the viteRoot variable. |
In the code where paths align,
A fallback now does shine.
No root set? No need to fear,
process.cwd()
is here!
Robust and steady, our code shall be,
With these changes, error-free.
🌟🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
LGTM
Thank you!
Description 描述
使用 vitest 测试时出现以下报错:
Linked Issues 关联的 Issues
issues https://github.com/uni-helper/vite-plugin-uni-pages/issues/164
Additional context 额外上下文
使用 vitest 测试 复现 demo: https://github.com/sunpm/vitesse-uniapp-vue3
Summary by CodeRabbit
VITE_ROOT_DIR
is not defined.