Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve dep optimization cache for each mode #9499

Open
7 tasks done
yuntian001 opened this issue Aug 2, 2022 · 2 comments
Open
7 tasks done

preserve dep optimization cache for each mode #9499

yuntian001 opened this issue Aug 2, 2022 · 2 comments
Labels
enhancement New feature or request feat: deps optimizer Esbuild Dependencies Optimization

Comments

@yuntian001
Copy link

Describe the bug

当vite dev 自定义模式mode(例如: vite --mode staging)启动时,总是会导致 optimized dependencies changed. reloading。

而直接用vite 或vite -m development启动时,没有这个问题。

用官方的vue ts包将 package.json 的scripts 的dev命令内容改为vite --mode staging 即可复现

Reproduction

https://github.com/vitejs/vite/tree/main/playground/vue

System Info

System:
    OS: Windows 10 10.0.17763
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 2.12 GB / 15.86 GB
  Binaries:
    Node: 16.15.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.13.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Internet Explorer: 11.0.17763.771

Used Package Manager

npm

Logs

No response

Validations

@sapphi-red sapphi-red changed the title 当vite dev 自定义模式mode(例如: vite --mode staging)启动时,总是会导致 optimized dependencies changed. reloading preverve dep optimization cache for each mode Aug 3, 2022
@sapphi-red
Copy link
Member

related code:

mode: process.env.NODE_ENV || config.mode,

maybe related: #8878

@sapphi-red sapphi-red added enhancement New feature or request and removed pending triage labels Aug 3, 2022
@sapphi-red sapphi-red changed the title preverve dep optimization cache for each mode preserve dep optimization cache for each mode Aug 3, 2022
@bluwy
Copy link
Member

bluwy commented Aug 4, 2022

I suppose this could be useful too. Though it can be workaround by specifying process.env.NODE_ENV = 'development' in the Vite config so that dev can share the optimized deps, and in most case the optimized deps for different modes shouldn't be much different too 🤔 But when we optimize deps in builds in the future, I think this might be useful.

@bluwy bluwy added the feat: deps optimizer Esbuild Dependencies Optimization label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feat: deps optimizer Esbuild Dependencies Optimization
Projects
None yet
Development

No branches or pull requests

3 participants