Gumaa
Explore posts from serversPerformance disadvantages of splitting components into separate chunks
So I'm working with Nuxt2. Usually if we have a component that is rendered using v-if (so it is not always needed) we import it like this:
And in the final build we get a separate JS chunk for this component. It is all fine.
But my question is - is there any potential drawback of importing every component like this? Would it be better to keep components that are always visible imported normally? Meaning:
Does creating bunch of small chunks hurt the performance and core web vitals?
I guess it could make it slightly worse, but the difference for a single component would be to small to measure it.
What do you think?
5 replies
What is a standard way of handling typescript in Nuxt3
I'm starting a fresh project and I wonder what should I do about typescript in Nuxt 3.
Normally I would create a folder
types
and put my ordinary types there and import them in my components. But is that a "standard" approach in new Nuxt?
Since other stuff is auto imported maybe the expected way is to add this folder to auto imports?
Or maybe I should just declare types globally?
Or stick to the old way?
For example Nuxtr does not even recommend any file structure for types, so maybe there is completely different way of handling it?4 replies
How to debug computed property
I have very weird case of "it is working, but I don't know why". And I don't know how to properly debug computed properties and find what exactly triggered them.
It will be hard for me to provide a link for reproduction, but I will try to describe my setup in simplified terms.
I have a component with a computed like this:
And I don't know why this computed is triggering, even though
product.value
is not changing. Somehow magically it knows when the return value of isProductExcluded
is different and it is relaunching whole computed.17 replies
Excluding certain directories when using "walk"
Hello, I'm writing a script that should crawl through a directory and search for a given text inside of these files. I'm having trouble understanding the documentation about walk options, specifically the
skip
option.
It says:
But it is enigmatic - what exactly is being checked? The name of a file? Path of the file? Absolute path? Relative path? It does not say.
If you are wondering I'm doing something like this:
So I just provided the name of a folder that I want to ignore. But I'm not sure if this is the correct approach or if this might ignore some extra files that I did not intent to ignore.2 replies