Comments (5)
还是要考虑边界情况的,如果 include
配置了 比如 **/*.mock.*
此类通配规则,那么默认的 exclude
有助于帮助内部 fast-glob
避免不必要的匹配导致的额外开销。
当然如果仅 应用默认的 include
规则是我希望的理想使用方式,以及我在 使用文档 给出了一些mock文件管理的建议。那么 exclude
几乎是一个不会产生实际作用的配置。
另外,在开发 vite
插件,和 rollup
插件时,社区有一个 vite 过滤与 include/exclude 模式 @rollup/pluginutils 以规范 文件匹配行为。插件当前的 include/exclude
遵循了这个规范。
from vite-plugin-mock-dev-server.
有个场景是需要在 cypress
目录中独立放置并维护一份专有 mock
文件,仅为自动化测试提供稳定数据,而项目根目录的 mock 数据在团队开发中会经常更改
from vite-plugin-mock-dev-server.
好问题,我将 cypress
列入到 排除文件中时,没有细想,在排除了 test
目录时很自然的写了 cypress
。
在做 e2e
测试时,提供稳定的数据支持可以保证 e2e
测试时不会被其他的意外因素干扰。但没有细想到 e2e
测试时需要的不是开发时的热数据,而是需要独立于开发时的冷数据,以保证 e2e
测试用例是可用的。
稍后我发布新的版本,删除 cypress
子项。
from vite-plugin-mock-dev-server.
我觉得吧,排除 node_modules
就够了...
from vite-plugin-mock-dev-server.
现在设计的 include
和 exclude
规则感觉用处不大,几乎所有的项目都只会集中维护一个 mock 文件,exclude
更是几乎用不到
from vite-plugin-mock-dev-server.
Related Issues (20)
- 关于mock前置拦截功能 HOT 2
- 1.1.6版本开始`transform`排序规则存在问题 HOT 3
- BUG(response error): appendHeader is not a function HOT 2
- 建议说明使用 ESModule 作为 mock 文件时,可能存在内存泄露风险。 HOT 2
- Invalid define value (must be an entity name or valid JSON syntax): {"BASE_URL":"./","MODE":"production","DEV":false,"PROD":true,"LEGACY":__VITE_IS_LEGACY__} HOT 3
- 如何设置mock 接口支持跨域?或如何 全局设置 mockConfig HOT 3
- 1.2.0版本导致vite启动报错 HOT 4
- 怎么只在yarn run preview下开启mock数据?不想在其他环境使用mock HOT 5
- vite4.x版本中使用别名导致随机性的导入一些方法失败 HOT 3
- 关于拦截问题
- [bot] add contributors HOT 13
- 多个mock模块如何公用一套数据? HOT 5
- 希望可以显式定义 *.mock.ts 文件加载顺序,以便于控制不同文件中 mock 规则优先级。 HOT 12
- defineConfig不存在,文档是不是没更新? HOT 4
- next() 无法将 POST 请求转交给 Vite 默认代理中间件 HOT 7
- 希望 `mockDevServerPlugin` 添加一个 `base_url` 配置 HOT 2
- 是否可以支持mock数据低优先级 HOT 4
- mockServer 独立部署安装和启动报错 HOT 3
- mockServer 正常启动,但是接口进 mockServer 服务后报错,和一些实验性建议 HOT 6
- 未配置 vite 的 proxy 参数和插件的 prefix 参数,应输出警告信息。 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-mock-dev-server.