Preloading animation for React webpack bundle

Muki

I have a single page webapp, which is about 300Kb big. It gets bundled with webpack and uses React/Redux.

How do I put a small loading spinner upfront until the page is loaded? I can image

  • putting the style and css into the static index.html
  • using an async loader like krux/postscribe
Arwed Mett

One way would be to insert the loading animation in the index.html

e.g.

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <div id="content">
            <div id="loader" />
        </div>
        <script src="build/app.js"></script>
    </body>
</html>

Then after the bundle.js is loaded it will render in the content and the loading animation will disappear.

EDIT:

Another method is to use a progressive webapp. https://developers.google.com/web/updates/2015/10/splashscreen

However this feature might only be available in modern browsers, which is why the first approach should be used as a fallback method. The benefit however is, that if your app is offline it will still play the loading animation and can give specific error messages.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Image Preloading for animation

From Dev

React webpack bundle not utf-8

From Dev

How to generate bundle.js with react and webpack?

From Dev

React, Webpack: bundle.js is not generated

From Dev

React with Webpack: PropTypes appearing in final bundle

From Dev

How to generate bundle.js with react and webpack?

From Dev

webpack including react 0.14-beta2 twice in final bundle

From Dev

How to serve production react bundle.js built by webpack?

From Dev

Using Webpack with React-router bundle.js Not Found

From Dev

Webpack / React/ Spring Boot: caching bundle.js with https

From Dev

How to exclude mobx and mobx-react from the bundle using webpack

From Dev

Is there a webpack config to bundle webpack plugin?

From Dev

Recreate this preloading screen--looks like a gif not a coded animation

From Dev

Using webpack to bundle CSS

From Dev

Versioning of webpack bundle in EJS

From Dev

webpack to bundle library antd

From Dev

React from NPM cannot be used on the client because 'development' is not defined. The bundle was generated from Webpack

From Dev

React FixedDataTable Webpack bundle - Uncaught TypeError: Cannot read property 'requestAnimationFrame' of undefined

From Dev

React webpack dev server works but when I create prod bundle I get reference error "require is not defined"

From Dev

webpack bundle.js not found

From Dev

Execute webpack compiled bundle in NodeJS

From Dev

Webpack build commenting out bundle

From Dev

Exclude a module from webpack bundle

From Dev

Webpack bundle named requirejs modules

From Dev

Webpack bundle dynamic client config

From Dev

WebPack Dynamically load bundle on demand

From Dev

Webpack 1.12: Bundle css files

From Dev

configure webpack for not bundle angularjs library

From Dev

React with webpack

Related Related

  1. 1

    Image Preloading for animation

  2. 2

    React webpack bundle not utf-8

  3. 3

    How to generate bundle.js with react and webpack?

  4. 4

    React, Webpack: bundle.js is not generated

  5. 5

    React with Webpack: PropTypes appearing in final bundle

  6. 6

    How to generate bundle.js with react and webpack?

  7. 7

    webpack including react 0.14-beta2 twice in final bundle

  8. 8

    How to serve production react bundle.js built by webpack?

  9. 9

    Using Webpack with React-router bundle.js Not Found

  10. 10

    Webpack / React/ Spring Boot: caching bundle.js with https

  11. 11

    How to exclude mobx and mobx-react from the bundle using webpack

  12. 12

    Is there a webpack config to bundle webpack plugin?

  13. 13

    Recreate this preloading screen--looks like a gif not a coded animation

  14. 14

    Using webpack to bundle CSS

  15. 15

    Versioning of webpack bundle in EJS

  16. 16

    webpack to bundle library antd

  17. 17

    React from NPM cannot be used on the client because 'development' is not defined. The bundle was generated from Webpack

  18. 18

    React FixedDataTable Webpack bundle - Uncaught TypeError: Cannot read property 'requestAnimationFrame' of undefined

  19. 19

    React webpack dev server works but when I create prod bundle I get reference error "require is not defined"

  20. 20

    webpack bundle.js not found

  21. 21

    Execute webpack compiled bundle in NodeJS

  22. 22

    Webpack build commenting out bundle

  23. 23

    Exclude a module from webpack bundle

  24. 24

    Webpack bundle named requirejs modules

  25. 25

    Webpack bundle dynamic client config

  26. 26

    WebPack Dynamically load bundle on demand

  27. 27

    Webpack 1.12: Bundle css files

  28. 28

    configure webpack for not bundle angularjs library

  29. 29

    React with webpack

HotTag

Archive