Gathering detailed insights and metrics for react-loadable-ssr-addon-v5-slorber
Gathering detailed insights and metrics for react-loadable-ssr-addon-v5-slorber
Gathering detailed insights and metrics for react-loadable-ssr-addon-v5-slorber
Gathering detailed insights and metrics for react-loadable-ssr-addon-v5-slorber
react-loadable-ssr-addon
Server Side Render add-on for React Loadable. Load splitted chunks was never that easy.
gatsby-plugin-loadable-components-ssr
Server-side rendering loadable components in your gatsby application
@docusaurus/react-loadable
A higher order component for loading components with promises
@slorber/static-site-generator-webpack-plugin
Minimal, unopinionated static site generator powered by webpack
Server Side Render add-on for React Loadable. Load splitted chunks was never that easy.
npm install react-loadable-ssr-addon-v5-slorber
61.8
Supply Chain
74.2
Quality
73.9
Maintenance
100
Vulnerability
99.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
69 Stars
66 Commits
19 Forks
5 Watching
1 Branches
8 Contributors
Updated on 30 Apr 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-10.4%
45,331
Compared to previous day
Last week
4.9%
280,236
Compared to previous week
Last month
2.8%
1,237,431
Compared to previous month
Last year
53%
12,973,353
Compared to previous year
1
2
31
Server Side Render add-on for React Loadable. Load splitted chunks was never that easy.
React Loadable SSR Add-on
is a server side render
add-on for React Loadable
that helps you to load dynamically all files dependencies, e.g. splitted chunks
, css
, etc.
Oh yeah, and we also provide support for SRI (Subresource Integrity).
Download our NPM Package
1npm install react-loadable-ssr-addon 2# or 3yarn add react-loadable-ssr-addon
Note: react-loadable-ssr-addon
should not be listed in the devDependencies
.
First we need to import the package into our component;
1const ReactLoadableSSRAddon = require('react-loadable-ssr-addon'); 2 3module.exports = { 4 entry: { 5 // ... 6 }, 7 output: { 8 // ... 9 }, 10 module: { 11 // ... 12 }, 13 plugins: [ 14 new ReactLoadableSSRAddon({ 15 filename: 'assets-manifest.json', 16 }), 17 ], 18};
1// import `getBundles` to map required modules and its dependencies 2import { getBundles } from 'react-loadable-ssr-addon'; 3// then import the assets manifest file generated by the Webpack Plugin 4import manifest from './your-output-folder/assets-manifest.json'; 5 6... 7 8// react-loadable ssr implementation 9const modules = new Set(); 10 11const html = ReactDOMServer.renderToString( 12<Loadable.Capture report={moduleName => modules.add(moduleName)}> 13 <App /> 14</Loadable.Capture> 15); 16 17... 18 19// now we concatenate the loaded `modules` from react-loadable `Loadable.Capture` method 20// with our application entry point 21const modulesToBeLoaded = [...manifest.entrypoints, ...Array.from(modules)]; 22// also if you find your project still fetching the files after the placement 23// maybe a good idea to switch the order from the implementation above to 24// const modulesToBeLoaded = [...Array.from(modules), ...manifest.entrypoints]; 25// see the issue #6 regarding this thread 26// https://github.com/themgoncalves/react-loadable-ssr-addon/issues/6 27 28// after that, we pass the required modules to `getBundles` map it. 29// `getBundles` will return all the required assets, group by `file type`. 30const bundles = getBundles(manifest, modulesToBeLoaded); 31 32// so it's easy to implement it 33const styles = bundles.css || []; 34const scripts = bundles.js || []; 35 36res.send(` 37 <!doctype html> 38 <html lang="en"> 39 <head>...</head> 40 ${styles.map(style => { 41 return `<link href="/dist/${style.file}" rel="stylesheet" />`; 42 }).join('\n')} 43 <body> 44 <div id="app">${html}</div> 45 ${scripts.map(script => { 46 return `<script src="/dist/${script.file}"></script>` 47 }).join('\n')} 48 </html> 49`);
See how easy to implement it is?
filename
Type: string
Default: react-loadable.json
Assets manifest file name. May contain relative or absolute path.
integrity
Type: boolean
Default: false
Enable or disable generation of Subresource Integrity (SRI). hash.
integrityAlgorithms
Type: array
Default: [ 'sha256', 'sha384', 'sha512' ]
Algorithms to generate hash.
integrityPropertyName
Type: string
Default: integrity
Custom property name to be output in the assets manifest file.
Full configuration example
1new ReactLoadableSSRAddon({
2 filename: 'assets-manifest.json',
3 integrity: false,
4 integrityAlgorithms: [ 'sha256', 'sha384', 'sha512' ],
5 integrityPropertyName: 'integrity',
6})
getBundles
1import { getBundles } from 'react-loadable-ssr-addon'; 2 3/** 4 * getBundles 5 * @param {object} manifest - The assets manifest content generate by ReactLoadableSSRAddon 6 * @param {array} chunks - Chunks list to be loaded 7 * @returns {array} - Assets list group by file type 8 */ 9const bundles = getBundles(manifest, modules); 10 11 12const styles = bundles.css || []; 13const scripts = bundles.js || []; 14const xml = bundles.xml || []; 15const json = bundles.json || []; 16...
Basic Structure
1{ 2 "entrypoints": [ ], 3 "origins": { 4 "app": [ ] 5 }, 6 "assets": { 7 "app": { 8 "js": [ 9 { 10 "file": "", 11 "hash": "", 12 "publicPath": "", 13 "integrity": "" 14 } 15 ] 16 } 17 } 18}
entrypoints
Type: array
List of all application entry points defined in Webpack entry
.
origins
Type: array
Origin name requested. List all assets required for the requested origin.
assets
Type: array
of objects
Lists all application assets generate by Webpack, group by file type,
containing an array of objects
with the following format:
1[file-type]: [ 2 { 3 "file": "", // assets file 4 "hash": "", // file hash generated by Webpack 5 "publicPath": "", // assets file + webpack public path 6 "integrity": "" // integrity base64 hash, if enabled 7 } 8]
1{ 2 "entrypoints": [ 3 "app" 4 ], 5 "origins": { 6 "./home": [ 7 "home" 8 ], 9 "./about": [ 10 "about" 11 ], 12 "app": [ 13 "vendors", 14 "app" 15 ], 16 "vendors": [ 17 "app", 18 "vendors" 19 ] 20 }, 21 "assets": { 22 "home": { 23 "js": [ 24 { 25 "file": "home.chunk.js", 26 "hash": "fdb00ffa16dfaf9cef0a", 27 "publicPath": "/dist/home.chunk.js", 28 "integrity": "sha256-Xxf7WVjPbdkJjgiZt7mvZvYv05+uErTC9RC2yCHF1RM= sha384-9OgouqlzN9KrqXVAcBzVMnlYOPxOYv/zLBOCuYtUAMoFxvmfxffbNIgendV4KXSJ sha512-oUxk3Swi0xIqvIxdWzXQIDRYlXo/V/aBqSYc+iWfsLcBftuIx12arohv852DruxKmlqtJhMv7NZp+5daSaIlnw==" 29 } 30 ] 31 }, 32 "about": { 33 "js": [ 34 { 35 "file": "about.chunk.js", 36 "hash": "7e88ef606abbb82d7e82", 37 "publicPath": "/dist/about.chunk.js", 38 "integrity": "sha256-ZPrPWVJRjdS4af9F1FzkqTqqSGo1jYyXNyctwTOLk9o= sha384-J1wiEV8N1foqRF7W9SEvg2s/FhQbhpKFHBTNBJR8g1yEMNRMi38y+8XmjDV/Iu7w sha512-b16+PXStO68CP52R+0ZktccMiaI1v0jOy34l/DqyGN7kEae3DpV3xPNoC8vt1WfE1kCAH7dlnHDdp1XRVhZX+g==" 39 } 40 ] 41 }, 42 "app": { 43 "css": [ 44 { 45 "file": "app.css", 46 "hash": "5888714915d8e89a8580", 47 "publicPath": "/dist/app.css", 48 "integrity": "sha256-3y4DyCC2cLII5sc2kaElHWhBIVMHdan/tA0akReI9qg= sha384-vCMVPKjSrrNpfnhmCD9E8SyHdfPdnM3DO/EkrbNI2vd0m2wH6BnfPja6gt43nDIF" 49 } 50 ], 51 "js": [ 52 { 53 "file": "app.bundle.js", 54 "hash": "0cbd05b10204597c781d", 55 "publicPath": "/dist/app.bundle.js", 56 "integrity": "sha256-sGdw+WVvXK1ZVQnYHI4FpecOcZtWZ99576OHCdrGil8= sha384-DZZzkPtPCTCR5UOWuGCyXQvsjyvZPoreCzqQGyrNV8+HyV9MdoYZawHX7NdGGLyi sha512-y29BlwBuwKB+BeXrrQYEBrK+mfWuOb4ok6F57kGbtrwa/Xq553Zb7lgss8RNvFjBSaMUdvXiJuhmP3HZA0jNeg==" 57 } 58 ] 59 }, 60 "vendors": { 61 "css": [ 62 { 63 "file": "vendors.css", 64 "hash": "5a9586c29103a034feb5", 65 "publicPath": "/dist/vendors.css" 66 } 67 ], 68 "js": [ 69 { 70 "file": "vendors.chunk.js", 71 "hash": "5a9586c29103a034feb5", 72 "publicPath": "/dist/vendors.chunk.js" 73 } 74 ] 75 } 76 } 77}
Marcos Gonçalves – LinkedIn – Website
Distributed under the MIT license. Click here for more information.
https://github.com/themgoncalves/react-loadable-ssr-addon
git checkout -b feature/fooBar
)git commit -m ':zap: Add some fooBar'
)git push origin feature/fooBar
)⚡️ New feature (:zap:
)
🐛 Bug fix (:bug:
)
🔥 P0 fix (:fire:
)
✅ Tests (:white_check_mark:
)
🚀 Performance improvements (:rocket:
)
🖍 CSS / Styling (:crayon:
)
♿ Accessibility (:wheelchair:
)
🌐 Internationalization (:globe_with_meridians:
)
📖 Documentation (:book:
)
🏗 Infrastructure / Tooling / Builds / CI (:building_construction:
)
⏪ Reverting a previous change (:rewind:
)
♻️ Refactoring (like moving around code w/o any changes) (:recycle:
)
🚮 Deleting code (:put_litter_in_its_place:
)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/27 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
58 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More