hunyan-io / vite-plugin-vue-nested-sfc

Nest SFCs within your SFC.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two critical problems with blocks.

louiss0 opened this issue · comments

When it came to testing this library I have noticed two things.

  1. You can't create a component block within a nested sfc.
  2. You can't use a component that was created by the component block inside of another one.

I don't know if those decisions were intentional or not. but it seems like you did not think of this stuff.

If these two problems are not solved then using JSX would be the superior chioce. I think Number 1 does not need to be solved but No.2 does.

Along with #4 these are the problems with the library so far. I'm personally comfortable with the library as these problems will n

Created text component

Screenshot 2023-05-08-vue-nested-sfc-text-compoenent-133236
ot limit my current projects but they are still problems.

Attempt to use text component inside of the increment button one

Screenshot-vue-nested-sfc-test-increment-button-with-text-2023-05-08 133102

Link to minimal reproducible example

https://github.com/louiss0/vue-nested-sfc-test

Oh if you are done with these problems please go to 1.0.0 People will not take this lib seriously if you don't go to 1.0.0 soon. Or they will be suspicious. I know the JS community doesn't take this stuff seriously but please don't make that mistake.

Im rooting for the success of this lib

Thanks for the suggestions!

Regarding the first issue, it's due to how compiler-sfc parses blocks following the HTML Standard. Even within scripts you can't have a closing </script> inside a string (e.g. <script> const str = "</script>"; </script>). The same applies to other blocks including the component block, you can't include the literal </component> inside its content, because the content is treated as raw text.

Regarding the second issue, it has to wait until #6 is fixed.

Regarding the images, I'm not sure which issue they're referring to (the reproduction link doesn't have the same example), is this another issue?

Regarding the images, I'm not sure which issue they're referring to (the reproduction link doesn't have the same example), is this another issue?

Are you sure you looked at <HelloWorld /> they should be there. I'm reffering to number two.

Well then I'm going to have to maybe close this issue when No.2 is solved. This library is ready for prime time now. But I have to say that If No.2 is not solved this library will not grow too much.

Thanks for the suggestions!

Regarding the first issue, it's due to how compiler-sfc parses blocks following the HTML Standard. Even within scripts you can't have a closing </script> inside a string (e.g. <script> const str = "</script>"; </script>). The same applies to other blocks including the component block, you can't include the literal </component> inside its content, because the content is treated as raw text.

Regarding the second issue, it has to wait until #6 is fixed.

Regarding the images, I'm not sure which issue they're referring to (the reproduction link doesn't have the same example), is this another issue?

I think you forgot to solve the second problem I have found a way to use components that are inside of others but that is not how I want things to be done.

For me to use and SFC inside of another SFC I need to export the component then import it inside of the other one.

I wish there was a way to manipulate blocks so that the components would be auto imported this is what I mean here