From 19c96958a5c7fa1ec6d34bf46cbb02ab73f50f37 Mon Sep 17 00:00:00 2001 From: Romaric Pascal Date: Tue, 30 Apr 2024 17:14:20 +0100 Subject: [PATCH] Document npm tasks for bundler integrations --- docs/contributing/tasks.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/contributing/tasks.md b/docs/contributing/tasks.md index 89bc2507bd..50256e291a 100644 --- a/docs/contributing/tasks.md +++ b/docs/contributing/tasks.md @@ -99,3 +99,13 @@ This task will: ## Review app only After building the project with `npm run build` the Express.js review app can be started with `npm start --workspace @govuk-frontend/review`. This prevents the Gulp tasks triggered by `npm start` from running. + +## Bundler integration + +After building the project with `npm run build`, you can verify that the `govuk-frontend` package will be consumed correctly by mainstream bundlers with `npm run --workspace @govuk-frontend/bundler-integrations` (where bundler name is one of `rollup`, `webpack` or `vite`). + +This will use the specified bundler to compile `.github/workflows/bundler-integrations/src/index.mjs`. That file only imports one components, which will let us verify that [tree shaking] works as intended. The build output (in `.github/workflows/bundler-integrations/dist//`) should not contain the code of other components. + +You can also run `npm run build:all --workspace @govuk-frontend/bundler-integrations` to run all three bundlers in one go. + +[tree shaking]: https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking