Skip to content

Commit

Permalink
Updated Terser's mangle option
Browse files Browse the repository at this point in the history
This'll keep the names of our classes and functions intact for neater stacktraces.
The [impact on file size](#4076) is very acceptable in front of the maintainability gain.
  • Loading branch information
romaricpascal committed Aug 31, 2023
1 parent 1483100 commit 4f06a14
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/govuk-frontend/rollup.release.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,13 @@ export default defineConfig(({ i: input }) => ({
plugins: [
terser({
format: { comments: false },
mangle: { reserved: Object.keys(GOVUKFrontend) },
mangle: {
keep_classnames: true,
keep_fnames: true,
// Ensure all top-level exports skip mangling, for example
// non-function string constants like `export { version }`
reserved: Object.keys(GOVUKFrontend)
},

// Include sources content from source maps to inspect
// GOV.UK Frontend and other dependencies' source code
Expand Down

0 comments on commit 4f06a14

Please sign in to comment.