JS import/export module – 404 file not found

I tryed create a app which convert domain to IP. I’m new so please be understanding.
file check-ip.js

import check from './function';

const getDNS = document.querySelector('.enter_dns');
const { value } = getDNS;
const showIP = document.querySelector('.show_ip');
const btn = document.querySelector('.btn');

btn.addEventListener('click', () => {
  check(value, showIP);
});

file function.js

export default function check() {
  const { lookup } = require('dns');

  lookup(value, (error, address) => {
    if (error === null) {
      showIP.innerText = address;
    } else {
      showIP.innerText = `Ups, ${error}`;
    }
  });
}

html

</head>
<body>
    <div class="content">
      <h2 class="header">Enter www address to check IP:</h2>
      <span class="interaction">
        <input type="text" class="enter_dns" placeholder="domain name...">
        <button class="btn">CHECK</button>
      </span>
      <p class="show_ip"></p>
    </div>

    <script type="module" src="./js/function.js"></script>
    <script type="module" src="./js/check-ip.js"></script>

</body>
</html>

When I’m using CommonJS I have a problem: required is not defined, so I try by export/import module. I see this error:
enter image description here