fix: SSR vendor priority
This commit is contained in:
parent
00b598c295
commit
cbf05b9ffd
|
@ -13,8 +13,9 @@ function Document({
|
|||
base,
|
||||
config,
|
||||
css,
|
||||
meta,
|
||||
hasVendor,
|
||||
icon,
|
||||
meta,
|
||||
root,
|
||||
title,
|
||||
}) {
|
||||
|
@ -37,6 +38,7 @@ function Document({
|
|||
{config}
|
||||
<div id={appMountId}>{root}</div>
|
||||
</div>
|
||||
{hasVendor && <script src="/assets/web-vendor.js" />}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
@ -47,6 +49,7 @@ Document.propTypes = {
|
|||
base: PropTypes.string.isRequired,
|
||||
config: PropTypes.element.isRequired,
|
||||
css: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||
hasVendor: PropTypes.bool.isRequired,
|
||||
icon: PropTypes.string.isRequired,
|
||||
meta: PropTypes.objectOf(PropTypes.string).isRequired,
|
||||
root: PropTypes.element.isRequired,
|
||||
|
|
|
@ -16,6 +16,7 @@ export default async (stream, req, flecks) => {
|
|||
} = flecks.get('@flecks/web/server');
|
||||
// Extract assets.
|
||||
const css = [];
|
||||
let hasVendor = false;
|
||||
let inline = '';
|
||||
let isInScript = 0;
|
||||
let isSkipping = false;
|
||||
|
@ -34,7 +35,12 @@ export default async (stream, req, flecks) => {
|
|||
isSkipping = true;
|
||||
}
|
||||
else if (attribs.src) {
|
||||
js.push(attribs.src);
|
||||
if (attribs.src.match(/web-vendor\.js$/)) {
|
||||
hasVendor = true;
|
||||
}
|
||||
else {
|
||||
js.push(attribs.src);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ('style' === tagName && attribs['data-href']) {
|
||||
|
@ -66,6 +72,7 @@ export default async (stream, req, flecks) => {
|
|||
{dangerouslySetInnerHTML: {__html: await configSource(flecks, req)}},
|
||||
),
|
||||
css,
|
||||
hasVendor,
|
||||
icon,
|
||||
meta,
|
||||
root: React.createElement(await root(flecks, req)),
|
||||
|
|
Loading…
Reference in New Issue
Block a user