import * as url from 'Url';
{ parse: [Function: urlParse],
resolve: [Function: urlResolve],
resolveObject: [Function: urlResolveObject],
format: [Function: urlFormat],
Url: [Function: Url]
}
这不是一个构造函数。您需要使用其中一个公开的方法:
import * as url from 'url';
console.log(url.parse('https://www.google.com'))
Url {
protocol: 'https:',
slashes: true,
auth: null,
host: 'www.google.com',
port: null,
hostname: 'www.google.com',
hash: null,
search: null,
query: null,
pathname: '/',
path: '/',
href: 'https://www.google.com/' }
undefined
>
import m = require("m");
。 - Aluan Haddad