Skip to content

Commit e0c5f11

Browse files
soaringeagleevilebottnawi
soaringeagle
authored andcommitted
docs: catches the case whereby assets are an object (#311)
* updates example - catches the case whereby assets are an object * Update README.md correct typecheck in SSR example * Update README.md uses helper for isObject
1 parent 27b6c1a commit e0c5f11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,14 @@ Example Implementation:
314314
```js
315315
const webpack = require('webpack');
316316
const compiler = webpack({ ... });
317+
const isObject = require('is-object');
317318
const middleware = require('webpack-dev-middleware');
318319

319320
// This function makes server rendering of asset references consistent with different webpack chunk/entry configurations
320321
function normalizeAssets(assets) {
322+
if (isObject(assets)) {
323+
return Object.values(assets)
324+
}
321325
return Array.isArray(assets) ? assets : [assets]
322326
}
323327

0 commit comments

Comments
 (0)