vercel/ncc

VCC cannot transpile ngrok

Open

#1,255 建立於 2025年2月24日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)JavaScript (8,841 star) (273 fork)batch import
bughelp wanted

描述

Hi, I've the issue since I've started to use the ngrok for javascript client; It's the tool to tunel public trafic to localhost and the VCC is unnable to transpile to one file project contains ngrok definition/s

My typescript code is:

import grok from "ngrok";

async function run() {
  const url = await ngrok.connect({ port: 8080 }); // trouble belongs to here
  const response = await fetch(`${url}/example`);
// Rest of code... 
}

run()

Error trace:

ncc: Version 0.38.3
ncc: Compiling file index.js into CJS
ncc: Using typescript@5.3.3 (ncc built-in)
Error: Module parse failed: Unexpected token (10:21)
File was processed with these loaders:
 * ../../../../../AppData/Roaming/npm/node_modules/@vercel/ncc/dist/ncc/loaders/empty-loader.js
 * ../../../../../AppData/Roaming/npm/node_modules/@vercel/ncc/dist/ncc/loaders/relocate-loader.js
 * ../../../../../AppData/Roaming/npm/node_modules/@vercel/ncc/dist/ncc/loaders/shebang-loader.js
You may need an additional loader to handle the result of these loaders.
|
| module.exports = {
>   __webpack_require__.ab + "bin",
|   bin,
|   ready,
    at C:\sec\AppData\Roaming\npm\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:23:2001732
    at C:\sec\Roaming\npm\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:23:389111
    at _done (eval at create (C:\sec\AppData\Roaming\npm\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:21:81694), <anonymous>:9:1)
    at eval (eval at create (C:\sec\AppData\Roaming\npm\node_modules\@vercel\ncc\dist\ncc/index.js.cache.js:21:81694), <anonymous>:34:22)

I've tested under various conditions and the error occurs, until I remove the line with ngrok

const url = await ngrok.connect({ port: 8080 });

Have you some way to deal with ngrok and still use the vcc?

貢獻者指南