Socket
Socket
Sign inDemoInstall

react-loadable

Package Overview
Dependencies
6
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.4 to 5.3.0

13

lib/webpack.js

@@ -17,3 +17,8 @@ 'use strict';

var name = typeof module.libIdent === 'function' ? module.libIdent({ context: context }) : null;
manifest[module.rawRequest] = { id: id, name: name, file: file };
if (!manifest[module.rawRequest]) {
manifest[module.rawRequest] = [];
}
manifest[module.rawRequest].push({ id: id, name: name, file: file });
});

@@ -58,5 +63,5 @@ });

function getBundles(manifest, moduleIds) {
return moduleIds.map(function (moduleId) {
return manifest[moduleId];
});
return moduleIds.reduce(function (bundles, moduleId) {
return bundles.concat(manifest[moduleId]);
}, []);
}

@@ -63,0 +68,0 @@

{
"name": "react-loadable",
"version": "5.2.4",
"version": "5.3.0",
"description": "A higher order component for loading components with promises",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -1112,1 +1112,35 @@ ![React Loadable](http://thejameskyle.com/img/react-loadable-header.png)

```
### How do I handle other styles `.css` or sourcemaps `.map` with server-side rendering?
When you call [`getBundles`](#getbundles), it may return file types other than
JavaScript depending on your Webpack configuration.
To handle this, you should manually filter down to the file extensions that
you care about:
```js
let bundles = getBundles(stats, modules);
let styles = bundles.filter(bundle => bundle.endsWith('.css'));
let scripts = bundles.filter(bundle => bundle.endsWith('.js'));
res.send(`
<!doctype html>
<html lang="en">
<head>
...
${styles.map(style => {
return `<link href="/dist/${style.file}" rel="stylesheet"/>`
}).join('\n')}
</head>
<body>
<div id="app">${html}</div>
<script src="/dist/main.js"></script>
${scripts.map(script => {
return `<script src="/dist/${script.file}"></script>`
}).join('\n')}
</body>
</html>
`);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc