Inline scripts in HTML files
This commit is contained in:
@ -1,17 +0,0 @@
|
||||
// Virtual module id; see rollup.config.js
|
||||
import entryManifest from 'entry-manifest';
|
||||
|
||||
export default function getEntryPoint(name, format) {
|
||||
let entryPoints;
|
||||
entryManifest.forEach(manifest => {
|
||||
if (name in manifest) {
|
||||
entryPoints = manifest[name];
|
||||
}
|
||||
});
|
||||
|
||||
if (entryPoints) {
|
||||
return entryPoints.find(e => e.format === format);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
import invariant from 'invariant';
|
||||
|
||||
import getEntryPoint from './getEntryPoint';
|
||||
|
||||
export default function getScripts(entryName, globalURLs) {
|
||||
const entryPoint = getEntryPoint(entryName, 'iife');
|
||||
|
||||
invariant(entryPoint, 'Invalid entry name "%s"', entryName);
|
||||
|
||||
const globalScripts = entryPoint.globalImports.map(id => {
|
||||
invariant(globalURLs[id], 'Missing global URL for id "%s"', id);
|
||||
return globalURLs[id];
|
||||
});
|
||||
|
||||
return globalScripts.concat(entryPoint.url);
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
|
||||
const doctype = '<!DOCTYPE html>';
|
||||
|
||||
export default function renderTemplate(component, props) {
|
||||
return (
|
||||
doctype +
|
||||
ReactDOMServer.renderToStaticMarkup(React.createElement(component, props))
|
||||
);
|
||||
}
|
Reference in New Issue
Block a user