Skip to content

Commit

Permalink
Added bundle analysis to the config template of react project (#649)
Browse files Browse the repository at this point in the history
* added bundle analysis

* added webpack plugin

* removed unnecessary package

* refactor

* removed unnecessary command

* comment fix

* comment fix
  • Loading branch information
hazal-karakus authored Jan 7, 2025
1 parent 9958a16 commit 600b231
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/run_codecov_on_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ jobs:
node-version: "18"

- name: Run React tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
npm install
CI=false ./build.sh
npm test -- --coverage --reporters=jest-junit
working-directory: ./empower/react
- uses: codecov/codecov-action@v3
Expand Down
12 changes: 9 additions & 3 deletions react/config-overrides.js.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const SentryWebpackPlugin = require('@sentry/webpack-plugin');
const reactsourceMapPlugin = require('@acemarke/react-prod-sourcemaps');
const { codecovWebpackPlugin } = require('@codecov/webpack-plugin');

module.exports = function override(config, env) {
//do stuff with the webpack config...
Expand All @@ -8,7 +9,6 @@ module.exports = function override(config, env) {
mode: 'strict',
})
);

config.plugins.push(
SentryWebpackPlugin.sentryWebpackPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
Expand All @@ -18,8 +18,14 @@ module.exports = function override(config, env) {
ignoreFile: '.sentrycliignore',
ignore: ['webpack.config.js'],
configFile: 'sentry.properties',
reactComponentAnnotation: {enabled:true},
})
);
config.plugins.push(
codecovWebpackPlugin({
enableBundleAnalysis: process.env.CI !== undefined || process.env.CODECOV_TOKEN !== undefined,
bundleName: "empower-react-app",
uploadToken: process.env.CODECOV_TOKEN,
})
);
return config;
};
};
Loading

0 comments on commit 600b231

Please sign in to comment.