fix: try to serve a static route before maping assets

This commit is contained in:
Sérgio Ramos 2018-05-09 10:34:49 +01:00
parent 831be94521
commit f007889283
4 changed files with 37 additions and 37 deletions

View File

@ -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: '*',

View File

@ -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: '*',

View File

@ -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
});
}
}
]);
};

View File

@ -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';