-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Bug Report]: unplugin-vue-fervid #62
Comments
Regarding the solution to css, it seems that you can use virtual modules to dynamically import css repeatedly to solve the specific implementation. I will try it again |
Regarding this distinction between modules in various formats, I feel that the current implementation method may be better. It mainly refers to performance problems. Now it means that no matter what kind of virtual module comes in, I need to run the asynccompile method aside. |
this I don't know if my explanation is correct |
Hi @ErKeLost , you are using https://www.w3schools.com/tags/tag_base.asp You can simply rename it to something else, like BaseComponent.vue
Not sure if you are happy with the current implementation or you think it needs to be different? |
@phoenix-ru ok i will try, but if base is used in @vue/compiler-sfc, it can be used as a component, I can try BaseComponents to load it for now thanks |
https://github.com/unplugin/unplugin-vue-fervid/blob/main/src/core/index.ts It is now running well in vite. I need to split up the css part, so I can write a version first. Since I need to call asymccompile repeatedly every time, I am not sure if it will affect performance. For example, when I encounter a css module, I need to dynamically load an import of css similar to a virtual module. I will try to write it first. |
There are also some things we may need to do in the future, such as retaining component states and compiling script template styles. I think this method may be necessary so that we can ensure more granular and meticulous completion of the entire compilation. My next step is to start writing farm's Rust version of the vue plug-in. I think this will greatly improve the future of the vue ecosystem |
You shouldn't worry about the performance for async compilation because it will use real multithreading leading to 4 files being processed at the same time (thanks to |
If I write multiple style blocks in a vue file, the generated code will return the entire css of the current file, right? I will help you after I finish compiling css |
It looks like a styles array has been generated. I understand |
The compilation of css has been completed and I encountered another problem Normally, this code will work <script setup lang="ts">
import { ref } from 'vue'
const message = ref('Hello Vue!')
const isVisible = ref(true)
const toggleMessage = () => {
isVisible.value = !isVisible.value
}
</script>
<template>
<div class="container">
<h1>Basic Vue</h1>
<button @click="toggleMessage">Toggle Message</button>
<p v-if="isVisible">{{ message }}</p>
</div>
</template> But I had some problems clicking the trigger button lockdown-install.js:1 Removing unpermitted intrinsics
runtime-core.esm-bundler.js:51 [Vue warn]: Unhandled error during execution of component update
at </Users/adny/typescript/unpluginVueFervid/examples/vite/src/base>
at </Users/adny/typescript/unpluginVueFervid/examples/vite/src/App>
warn$1 @ runtime-core.esm-bundler.js:51
logError @ runtime-core.esm-bundler.js:263
handleError @ runtime-core.esm-bundler.js:255
callWithErrorHandling @ runtime-core.esm-bundler.js:201
flushJobs @ runtime-core.esm-bundler.js:408
Promise.then
queueFlush @ runtime-core.esm-bundler.js:322
queueJob @ runtime-core.esm-bundler.js:317
effect2.scheduler @ runtime-core.esm-bundler.js:5448
trigger @ reactivity.esm-bundler.js:253
endBatch @ reactivity.esm-bundler.js:311
notify @ reactivity.esm-bundler.js:597
trigger @ reactivity.esm-bundler.js:571
set value @ reactivity.esm-bundler.js:1448
toggleMessage @ base.vue:39
callWithErrorHandling @ runtime-core.esm-bundler.js:199
callWithAsyncErrorHandling @ runtime-core.esm-bundler.js:206
invoker @ runtime-dom.esm-bundler.js:729了解此警告AI
runtime-core.esm-bundler.js:5043 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'el')
at patchBlockChildren (runtime-core.esm-bundler.js:5043:18)
at patchElement (runtime-core.esm-bundler.js:4972:7)
at processElement (runtime-core.esm-bundler.js:4831:7)
at patch (runtime-core.esm-bundler.js:4688:11)
at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5406:9)
at ReactiveEffect.run (reactivity.esm-bundler.js:225:19)
at ReactiveEffect.runIfDirty (reactivity.esm-bundler.js:263:12)
at callWithErrorHandling (runtime-core.esm-bundler.js:199:33)
at flushJobs (runtime-core.esm-bundler.js:408:9) Maybe this is a problem with the vue version? current version "dependencies": {
"vue": "^3.5.13"
}, |
The second question seems to have not removed the type when compiled. Perhaps I wrote less configuration lang=ts has been specified <script setup lang="ts">
import { ref, watch } from "vue";
import BaseCmp from "./base.vue";
const msg = ref("Welcome to my beautiful page!");
watch(msg, (newVal) => {
console.log(newVal);
});
const count = ref(0); |
Wow, it's amazing to hear!! Regarding Typescript, Fervid doesn't strip types, as it's usually the work of ts-loader which should consume the output of Fervid. |
I feel that swc should handle this operation back. I can look at this problem later. |
Another problem is that after initializing the vite project, clicking the button does not render to the template <script setup lang="ts">
import { ref } from 'vue'
defineProps<{ msg: string }>()
const count = ref(0)
function counter() {
count.value++
console.log("count", count.value);
}
</script>
<template>
<h1>{{ msg }}</h1>
<div class="card">
<button type="button" @click="counter">count is {{ count }}</button>
<p>
Edit
<code>components/HelloWorld.vue</code> to test HMR
</p>
</div>
</template> count always be 0 |
I will check if Vue 3.5 did some breaking changes to how template is rendered. This is not nice as I know such usage worked |
I also found a few problems and I'll see if I can solve them. |
Thank you for the lead! I think it's related to the fact that Fervid's patch flags implementation is incomplete yet. I really appreciate you testing different things! |
ok Regarding the questions I will continue to test unplugin-vue-fervid in the future, I will continue to ask questions on this issues, and I will open new issues and prs for other issues that can be solved. What do you think? |
When we can solve most of the known problems, I think we can promote it to users and start writing farm's rust plugin, and even provide it to rolldown or rspack in the future. |
I am fine with it :) Feel free to open issues/PRs and ping me. |
@phoenix-ru hi I used farm to conduct tests and compared compiler-sfc and fervid in the same environment. Maybe based on the differences in the machines, fervid is about four times faster than compiler-sfc. https://x.com/Adny56908922543/status/1886642205672268100 I am very looking forward to improving performance after we build the rust plugin. It will be another demonstration project of magnitude. I think it may be launched and completed within 10ms. |
@phoenix-ru hi I plan to start development of fervid,@farmfe/plugin-vue and unplugin-vue-fervid plugin-vue at the same time. I would like to sincerely invite you to join farm to build farm's rust ecosystem together. has been sent to you |
Thank you for the invite 🙂 |
Could you share the code you used for the benchmark? Repository is best, so I could try it out. The number 45 ms looks too high to me, I was usually getting 2-3 ms. |
|
@phoenix-ru hi
I'm trying to write farm and unplugin plug-ins. I'm currently encountering problems such as how to compile subcomponents. I now have two files, app.vue and base.vue, the app component introduces the base component, but the compiled effect treats Base as a node node instead of a component instance
do I have any problems operating in some places?
// unplugin-vue-fervid
![Image](https://private-user-images.githubusercontent.com/66500121/408518141-b9eafe59-aff9-46c2-822a-edfadf9e06ec.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTAxMzUsIm5iZiI6MTczOTE4OTgzNSwicGF0aCI6Ii82NjUwMDEyMS80MDg1MTgxNDEtYjllYWZlNTktYWZmOS00NmMyLTgyMmEtZWRmYWRmOWUwNmVjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDEyMTcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhNjcxY2U3NzE0YTc0NGM2Y2NlZGRiNWJlN2NmNmNmZWMxOTc0MWQwY2E3MjA5ZTA3ZTcyNWZhNDZiM2I0NzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K4uUQ-Mu9ViUxAC8Dj6JaIkL6a-HIZzgbaM2vt3msaQ)
// document
![Image](https://private-user-images.githubusercontent.com/66500121/408518051-8ddb3c4f-270f-4eb5-aa23-2b8d2814971a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTAxMzUsIm5iZiI6MTczOTE4OTgzNSwicGF0aCI6Ii82NjUwMDEyMS80MDg1MTgwNTEtOGRkYjNjNGYtMjcwZi00ZWI1LWFhMjMtMmI4ZDI4MTQ5NzFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDEyMTcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5MjJmODI0MWI0OWIwYmFjMTI0NGU5OWRiYTZmODAzMjk1YWEzNDQzNjk3MDI5YmJhZjgxNzUxNDEwNzBkZWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cQG1GctDuMsyCTbTHmJfzwMj0JWgnyGlUGumMPn4B5g)
// compilation code
![Image](https://private-user-images.githubusercontent.com/66500121/408517274-51a8cd02-a26f-47a1-a85c-301df1f6c92d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxOTAxMzUsIm5iZiI6MTczOTE4OTgzNSwicGF0aCI6Ii82NjUwMDEyMS80MDg1MTcyNzQtNTFhOGNkMDItYTI2Zi00N2ExLWE4NWMtMzAxZGYxZjZjOTJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDEyMTcxNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA5MmNkNmFhYzZlZDE3MmY3YWU0NTNjMDBlNTI4NWM4ZTExMzFmYzkxOTQxZDg4ODJjZmM1ZDhhYjM0ZGFlY2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Zj0YqNCV8qkO5Mf7F8eEVzTKSQcbEbNVHUFnb6mxzOM)
The text was updated successfully, but these errors were encountered: