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](https://github.com/alphagov/govuk-frontend/issues/4076\#issuecomment-1677677788) is very acceptable in front of the maintainability gain.
  • Loading branch information
romaricpascal committed Aug 31, 2023
1 parent 3026f54 commit c1af8e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion 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 c1af8e1

Please sign in to comment.