fix: remove redirect build on dev
This commit is contained in:
committed by
Stuart Taylor
parent
8ed9fae9ec
commit
d1c26a09dc
@ -13,7 +13,8 @@ const {
|
|||||||
API_LOCATION: api,
|
API_LOCATION: api,
|
||||||
FORUM_LOCATION: forum,
|
FORUM_LOCATION: forum,
|
||||||
FORUM_PROXY_LOCATION: forumProxy,
|
FORUM_PROXY_LOCATION: forumProxy,
|
||||||
LOCALE: locale
|
LOCALE: locale,
|
||||||
|
NODE_ENV: NODE_ENV
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
|
||||||
const locations = {
|
const locations = {
|
||||||
@ -30,15 +31,18 @@ const clientStaticPath = path.resolve(clientPath, 'static');
|
|||||||
const globalConfigPath = path.resolve(__dirname, '../../config');
|
const globalConfigPath = path.resolve(__dirname, '../../config');
|
||||||
const env = Object.assign(locations, {locale});
|
const env = Object.assign(locations, {locale});
|
||||||
|
|
||||||
const redirects = createRedirects({ api, home, forum, forumProxy });
|
if (NODE_ENV === 'production') {
|
||||||
|
const redirects = createRedirects({ api, home, forum, forumProxy });
|
||||||
fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
fs.writeFile(`${clientStaticPath}/_redirects`, redirects, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
log('Error');
|
log('Error');
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
log('_redirects written');
|
log('_redirects written');
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
log(`ignoring creation of redirect file in ${NODE_ENV}`);
|
||||||
|
}
|
||||||
|
|
||||||
fs.access(`${apiPath}/server/resources/pathMigration.json`, err => {
|
fs.access(`${apiPath}/server/resources/pathMigration.json`, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
Reference in New Issue
Block a user