fix: url.parse is deprecate

This commit is contained in:
kmmiio99o 2026-01-05 01:04:59 +01:00
parent 937144b45f
commit 0e7283aece
No known key found for this signature in database
GPG key ID: 163FE39F7772D2EC

View file

@ -4,7 +4,7 @@ import { readFile } from "fs/promises";
import http from "http";
import os from "os";
import readline from "readline";
import url from "url";
import { URL } from "url";
import yargs from "yargs-parser";
import { buildBundle } from "./build.mjs";
@ -15,7 +15,7 @@ const args = yargs(process.argv.slice(2));
export function serve(options) {
// @ts-ignore
const server = http.createServer(async (req, res) => {
const { pathname } = url.parse(req.url || "", true);
const { pathname } = new URL(req.url || "", `http://localhost:${args.port ?? 4040}`);
if (pathname?.endsWith(".js")) {
try {
let fileToServe;