unpkg/modules/utils/getEntryPoints.js
Michael Jackson 09914c1db4 Server render the main page
Also, add hashes to asset file names and use the "entry manifest" plugin
in dev to get auto-reloading.
2019-01-12 19:27:28 -08:00

20 lines
506 B
JavaScript

import invariant from 'invariant';
// Virtual module id; see rollup.config.js
import entryManifest from 'entry-manifest';
export default function getEntryPoints(entryName, formatKeys) {
const manifest = entryManifest[entryName];
invariant(manifest, 'Invalid entry name: %s', entryName);
return manifest.reduce((memo, entryPoint) => {
if (entryPoint.format in formatKeys) {
const key = formatKeys[entryPoint.format];
memo[key] = entryPoint.url;
}
return memo;
}, {});
}