Giter Club home page Giter Club logo

Comments (4)

euvl avatar euvl commented on May 18, 2024

Hey @piehei

It is the default behaviour of vue-loader in webpack i think: webpack/webpack#3329.

Did you do benchmarking? What is the performance fall?
I have people using it in prod. as noone mentioned about bad performance so i am curious now.

On the matter, I can prob. add a separate building task using ExtractTextPlugin.

E.g. you will have to do something like

`include('vue-js-modal/index_stripped.css')`
`include('vue-js-modal/index_stripped.js')`

Will it help?

Thanks for kind words 👍 😄

from vue-js-modal.

piehei avatar piehei commented on May 18, 2024

It causes the browser to recalculate styles if I'm not mistaken. That could cause the page to flash white and/or some jank.

The point being:

  1. Browser fetches the css bundle, processes it and calculates everything
  2. Browser fetches the js bundle
  3. The js dynamically adds more styles to the head
  4. The browser has to do recalculation

My own Vue components don't insert any css, everything is included in the single css bundle webpack generates. I don't use any other 3rd party components so cannot compare.

One thing to note: when using webpack dev server, all the styles are inserted into the DOM no matter what component is in question. But this should only happen in dev mode, not production if I'm not completely mistaken.

There shouldn't be any reason to add the css dynamically when the app is running (if we leave out all code-splitting sorcery).

Any thoughts? Am I missing something?

:-)

from vue-js-modal.

euvl avatar euvl commented on May 18, 2024

Yeah, you have a point.

I am still not sure if it is a problem though, especially for the component that should be invisible by default and if you already use some framework like Vue or React. Recalculating styles once is not a biggie in comparison to other operations your browser has to do to run 200kb+ of javascript :D

I have been using it in production for a while and never faced any problems (please consider that my home internet is 10mb/s shared between 3 ppl 😃 😢 😢 )

from vue-js-modal.

euvl avatar euvl commented on May 18, 2024

I've looked through a dozen of component to figure out how to pack it for distribution (i'm a webpack noob) and all of them supplied just .js and .js.map files in their dist.

Do you think the solution from my first answer will be useful for you?

Hope it will help you to bundle the css styles all together, but I do not want to break the plugin for other people who already have it in prod 😅

from vue-js-modal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.