fix: url.parse is deprecate
This commit is contained in:
parent
937144b45f
commit
0e7283aece
1 changed files with 2 additions and 2 deletions
|
|
@ -4,7 +4,7 @@ import { readFile } from "fs/promises";
|
||||||
import http from "http";
|
import http from "http";
|
||||||
import os from "os";
|
import os from "os";
|
||||||
import readline from "readline";
|
import readline from "readline";
|
||||||
import url from "url";
|
import { URL } from "url";
|
||||||
import yargs from "yargs-parser";
|
import yargs from "yargs-parser";
|
||||||
|
|
||||||
import { buildBundle } from "./build.mjs";
|
import { buildBundle } from "./build.mjs";
|
||||||
|
|
@ -15,7 +15,7 @@ const args = yargs(process.argv.slice(2));
|
||||||
export function serve(options) {
|
export function serve(options) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const server = http.createServer(async (req, res) => {
|
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")) {
|
if (pathname?.endsWith(".js")) {
|
||||||
try {
|
try {
|
||||||
let fileToServe;
|
let fileToServe;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue