[Dev] Statoscope: Only build reference.json in staging
This commit is contained in:
parent
bd21dc05f7
commit
9206ae42a9
@ -141,14 +141,14 @@ module.exports = (_env, { mode = 'production' }) => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
{
|
...(APP_ENV === 'staging' ? {
|
||||||
apply: (compiler) => {
|
apply: (compiler) => {
|
||||||
compiler.hooks.compile.tap('Before Compilation', async () => {
|
compiler.hooks.compile.tap('Before Compilation', async () => {
|
||||||
const stats = await fetch(STATOSCOPE_REFERENCE_URL).then((res) => res.text());
|
const stats = await fetch(STATOSCOPE_REFERENCE_URL).then((res) => res.text());
|
||||||
fs.writeFileSync(path.resolve('./public/reference.json'), stats);
|
fs.writeFileSync(path.resolve('./public/reference.json'), stats);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
} : []),
|
||||||
// Clearing of the unused files for code highlight for smaller chunk count
|
// Clearing of the unused files for code highlight for smaller chunk count
|
||||||
new ContextReplacementPlugin(
|
new ContextReplacementPlugin(
|
||||||
/highlight\.js[\\/]lib[\\/]languages/,
|
/highlight\.js[\\/]lib[\\/]languages/,
|
||||||
@ -200,10 +200,12 @@ module.exports = (_env, { mode = 'production' }) => {
|
|||||||
},
|
},
|
||||||
saveReportTo: path.resolve('./public/statoscope-report.html'),
|
saveReportTo: path.resolve('./public/statoscope-report.html'),
|
||||||
saveStatsTo: path.resolve('./public/build-stats.json'),
|
saveStatsTo: path.resolve('./public/build-stats.json'),
|
||||||
additionalStats: ['./public/reference.json'],
|
|
||||||
normalizeStats: true,
|
normalizeStats: true,
|
||||||
open: 'file',
|
open: 'file',
|
||||||
extensions: [new WebpackContextExtension()],
|
extensions: [new WebpackContextExtension()],
|
||||||
|
...(APP_ENV === 'staging' && {
|
||||||
|
additionalStats: ['./public/reference.json'],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user