[v0.14] Removed "src" folder from Quasar package
-
Hi All,
I see too many people importing from 'quasar/src/*" which is NOT the way to do it.
If you update to latest edge (v0.14) build and your app gets broken, it means you are importing from Quasar’s src folder which I just removed.Example. Instead of:
import QLayout from 'quasar/src/components/layout/QLayout'
you should do:
import { QLayout } from 'quasar'
-Razvan
-
material-ui and semantic
saidThis will make your build process faster and your build output smaller
if we import specific file instead of import { QLayout } from ‘quasar’is it better idea to remove the src folder?
-
@nueko Quasar has better internal mechanics. Importing like suggested will kick in tree-shaking, so it’s same thing.
-
great to hear that.
I hope I read that statement on the docs -
Great point showing that importing from ‘quasar’ is more efficient,
But what is the suitable way if I wanted to use quasar mixins such as ‘slider-mixin’ from ‘src/vue-components/slider/slider-mixin’?
Thanks.
-
@StrikerUnit that’s part of v0.13. If you are on v0.13 the “src” folder is still there.
-
Thanks, I just start trying out 0.14 so I wonder how it should be implement/import in this kind of situation.
-
I am seeing this way of no src in others too. It is ok but as developers we need to have src for several reasons:
a) Sometimes we need to read code and to know what it is happening rather than guessing, etc
b) Sometimes we need to raise an exception and to do strange and stupid things like to use src files directly or why not overload or fork code for whatever arise.
c) For me to have src is guarantee of being in a open and not blind software, it is how things stand up behind scene. It is not only what we do it is also what support us, so we need to make very smart choices like quasar
So in my humble opinion for development src should be there or accesible anywhere, but deployment is a complete different animal who needs to be fed in other way. -
The whole framework is open source, meaning you can see its code on github. All of it. Nothing is hidden. So you used to read it from node_modules, ok, I get that, but nothing is stopping you from reading it from “dev” branch of Quasar github repo. So points a) and c) are covered anyway.
Now on to point b). Again, nothing stopping you from extending current Quasar components. Import the component you want then change it accordingly and possibly reexport it with your own name.
Removing “src” folder is just a way to force developers correctly import Quasar components, nothing more. I’ve seen enough of “src” imports that I just can’t take it anymore
On top of that, “bugs” like “I’m importing Quasar components and when I build it says line X breaks UglifyJS”. And I’m like “huh? that is not possible…” Well, yeah, it is possible if you don’t follow the documentation and import Quasar the right way
Unless a very solid case of using “src” folder does not pop out, devs should import Quasar in the documented way. I currently do not see something that you could do with “src” but can’t do with how things are now. If I missed something please do tell.
Regards,
Razvan -
I’m interested in how to do the “b” point, but I don’t know how to start or how to do it properly.
Do you have any example or link that I can follow or read?
Thanks.
-
@rstoenescu When you get back from vacation I’d appreciate an example for point b.