Minify a html string in a worker

I use a simple template in my worker, something like this:

export default function page(msg) {
  return (`
  <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
<p> ${msg} </p>
</body>
</html>
  `)
}

and this is my index.js

import page from './page'

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  const { pathname } = new URL(request.url)

  if (pathname === '/') {
    return new Response(page("hellow world"), {
      headers: { 'content-type': 'text/html' },
    })
  }
}

now when I set mode: 'production' in my webpack.cofing.js nothing happens, and my page response is not minified.
I just want to know is there any way to minify my HTML response?