一个 Nuxt 模块,用于自动运行 localtunnel,以将您的 Nuxt 开发实例外部暴露给外部世界。
允许完全配置所有 localtunnel 配置选项,包括 https
npm install @nuxtus/nuxt-localtunnel
编辑您的 nuxt.config.ts 并添加 @nuxtus/nuxt-localtunnel 模块
modules: [
'@nuxtus/nuxt-localtunnel'
],
localtunnel: {} // Localtunnel config options go here (see below)
然后像往常一样启动 Nuxt npm run dev,您将获得一个额外的(外部 URL 来访问您的开发站点)。
所有 localtunnel 配置选项都通过 nuxt.config.ts 文件中的 localtunnel 属性接受
port (number) 要通过 localtunnel 暴露的本地端口号。subdomain (string) 请求代理服务器上的特定子域名。注意 您可能无法实际获得此名称,具体取决于可用性。host (string) 上游代理服务器的 URL。默认为 https://localtunnel.me。local_host (string) 代理到此主机名而不是 localhost。这也会导致代理请求中的 Host 头部被重写为该值。local_https (boolean) 启用隧道到本地 HTTPS 服务器。local_cert (string) 本地 HTTPS 服务器的证书 PEM 文件路径。local_key (string) 本地 HTTPS 服务器的证书密钥文件路径。local_ca (string) 自签名证书的证书颁发机构文件路径。allow_invalid_cert (boolean) 禁用本地 HTTPS 服务器的证书检查(忽略 cert/key/ca 选项)。有关证书选项的详细信息,请参阅 tls.createSecureContext。
npm run dev:prepare 以生成类型存根。npm run dev 在开发模式下启动 playground。