-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
实现方式疑问 #134
Comments
好主意,不过项目灵感起初来源于 vite-plugin-pages 俺觉得可以同时支持一下? |
且,现在的代码乱糟糟的,有空重构下吧 |
同时支持意义不大,因为实现原理完全不一样,如果要实现,估计得新开一个项目了。如果没意见,晚点有空的话,我新开一个 unplugin 的项目吧。 |
只需要 vite 插件就可以了,uniap p也不支持其他打包工具( |
我是指同时支持现有格式意义不大,因为无论实现方式,还是使用方式都完全不一样了。 至于使用unplugin,主要是因为已有成熟的范例可参考,至于支持其他打包工具只是顺带的功能。何况uniapp的vue2还是用webpack呢。 |
unplugin 对于uniapp 没啥必要,给自己刨坑,为了用而用不划算 |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
对问题的清晰和简明的描述
简单看了一下源码实现,是通过 vue 的 SFC parser 去解析自定义 route 节点,然后再写入 pages.json。
由于是自定义 route 节点,所以代码里还需要对vite和volar进行特别处理。
我的疑问是,为什么不参照 https://github.com/vue-macros/vue-macros 那样,使用
unplugin
进行处理? 比如defineOptions
,是可以直接写在 <script> 里面的,可以非常方便使用 ts 进行约束,无须对vite和volar进行特别处理。至于如今的可自定义解析器的功能,个人认为意义不大,因为对于前端用户来说,最方便的应该就是 JS 或 json了。如果想要支持多种配置方式,只需要让其支持函数即可,用户可自己引入所需的解析方式。
如:
推荐的解决方案
如上
替代方案
No response
额外上下文
No response
检查
The text was updated successfully, but these errors were encountered: