fix: try to serve a static route before maping assets
This commit is contained in:
parent
831be94521
commit
f007889283
@ -84,27 +84,27 @@ exports.register = async server => {
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, 'static', rest);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const filename = manifest[rest];
|
||||
if (!filename) {
|
||||
return Boom.notFound();
|
||||
}
|
||||
|
||||
const buildMapPathname = Path.join(buildRoot, filename);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildMapPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildMapPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, rest);
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
method: '*',
|
||||
|
@ -84,27 +84,27 @@ exports.register = async server => {
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, 'static', rest);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const filename = manifest[rest];
|
||||
if (!filename) {
|
||||
return Boom.notFound();
|
||||
}
|
||||
|
||||
const buildMapPathname = Path.join(buildRoot, filename);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildMapPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildMapPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, rest);
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
method: '*',
|
||||
|
@ -79,27 +79,27 @@ exports.register = async server => {
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, 'static', rest);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const filename = manifest[rest];
|
||||
if (!filename) {
|
||||
return Boom.notFound();
|
||||
}
|
||||
|
||||
const buildMapPathname = Path.join(buildRoot, filename);
|
||||
const [err2] = await Intercept(
|
||||
Fs.access(buildMapPathname, Fs.constants.R_OK)
|
||||
);
|
||||
|
||||
if (!err2) {
|
||||
return h.file(buildMapPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
|
||||
const buildPathname = Path.join(buildStatic, rest);
|
||||
return h.file(buildPathname, {
|
||||
confine: buildStatic
|
||||
});
|
||||
}
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { ThemeProvider, injectGlobal } from 'styled-components';
|
||||
import styled, { ThemeProvider, injectGlobal } from 'styled-components';
|
||||
|
||||
import theme from '../theme';
|
||||
import Base from '../base';
|
||||
|
Loading…
Reference in New Issue
Block a user