mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-19 06:10:56 +08:00
feat: support webpack profiling (#9804)
Co-authored-by: Martin Guillon <martin.guillon@akylas.fr>
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { redBright, green, greenBright } from 'chalk';
|
||||
import { redBright, green, greenBright, yellow } from 'chalk';
|
||||
import { program } from 'commander';
|
||||
import dedent from 'ts-dedent';
|
||||
import webpack from 'webpack';
|
||||
@ -115,6 +115,28 @@ program
|
||||
errorDetails: env.verbose,
|
||||
})
|
||||
);
|
||||
|
||||
// if webpack profile is enabled we write the stats to a JSON file
|
||||
if (configuration.profile || env.profile) {
|
||||
console.log(
|
||||
[
|
||||
'',
|
||||
'|',
|
||||
`| The build profile has been written to ${yellow(
|
||||
'webpack.stats.json'
|
||||
)}`,
|
||||
`| You can analyse the stats at ${green(
|
||||
'https://webpack.github.io/analyse/'
|
||||
)}`,
|
||||
'|',
|
||||
'',
|
||||
].join('\n')
|
||||
);
|
||||
fs.writeFileSync(
|
||||
path.join(process.cwd(), 'webpack.stats.json'),
|
||||
JSON.stringify(stats.toJson())
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user