This is a JavaScript/TypeScript package to collect metrics that relate to developers' experience.
Install the package:
npm install --save-dev agoda-devfeedback
or
yarn add --dev agoda-devfeedback
Please note that when an error happens, the package will put the error message to devfeedback.log
file in the current working directory.
You might need to add this file to .gitignore
to avoid committing it to the repository.
This package supports collecting the build time (compilation time) of projects that are using Webpack (4.x or 5.x) or Vite (4.x).
This package also supports collecting the bundle size of your project. This helps in understanding the size of the final output and optimizing it for better performance.
You can define an endpoint in the environment variable and the stats data will be sent there via HTTP POST Request
Environment Variable | Default Value |
---|---|
WEBPACK_ENDPOINT | http://compilation-metrics/webpack |
VITE_ENDPOINT | http://compilation-metrics/vite |
If you use Webpack, you can add the following to your webpack.config.js
file:
const { WebpackBuildStatsPlugin } = require('agoda-devfeedback');
module.exports = {
// ...
plugins: [
// ...
new WebpackBuildStatsPlugin(),
],
};
If you use Vite you can add the following to your vite.config.js
file:
import { viteBuildStatsPlugin } from 'agoda-devfeedback';
export default defineConfig({
// ...
plugins: [
// ...
viteBuildStatsPlugin(),
],
});
Both Webpack and Vite plugins will not only send the build data but also send the command that you used to run the build like yarn dev
or yarn build
to be the build identifier which should work in most cases in order to help you distinguish between different build configurations.
However, if you would like to define your own identifier, you can do so by passing it as a parameter to the plugin.
new WebpackBuildStatsPlugin('production');
or
viteBuildStatsPlugin('production');