Giter Club home page Giter Club logo

listhen's Introduction

πŸ‘‚ listhen

npm version npm downloads

Elegant HTTP listener!

πŸ‘‰ Online Playground

Features

βœ… Dev server with HMR, static, WebSockets and typescript support with unjs/jiti

βœ… Works with Node.js, express, and unjs/h3 out of the box

βœ… Show the QR code of the public URL with unjs/uqr

βœ… Tunnel your local server to the world with unjs/untun

βœ… Assign a port or fallback to a nicer alternative with unjs/get-port-please

βœ… Gracefully shutdown Server with http-shutdown

βœ… Zero Config WebSockets with unjs/crossws

βœ… Copy the URL to the clipboard

βœ… HTTPS support with self-signed certificates

βœ… Open URL in browser

βœ… Detect test and production environments to auto-adjust behavior

βœ… Close on the exit signal

Quick Usage (CLI)

You can run your applications in localhost with typescript support and watch mode using listhen CLI:

Create index.ts:

export default (req, res) => {
  res.end("Hello World!");
};

or using unjs/h3:

import { createApp, eventHandler } from "h3";

export const app = createApp();

app.use(
  "/",
  eventHandler(() => "Hello world!"),
);

or use npx to invoke listhen command:

npx listhen -w ./index.ts

Usage (API)

Install package:

# pnpm
pnpm i listhen

# npm
npm i listhen

# yarn
yarn add listhen

Import into your Node.js project:

// CommonJS
const { listen, listenAndWatch } = require("listhen");

// ESM
import { listen, listenAndWatch } from "listhen";
const handler = (req, res) => {
  res.end("Hi!")
}

// listener: { url, getURL, server, close, ... }
const listener = await listen(handler, options?)

Options

port

  • Default: process.env.PORT or 3000 or memorized random (see get-port-please)

Port to listen.

hostname

  • Default: process.env.HOST || '0.0.0.0'

Default hostname to listen.

https

  • Type: Boolean | Object
  • Default: false

Listen on HTTPS with SSL enabled.

Self-Signed Certificate

By setting https: true, listhen will use an auto-generated self-signed certificate.

You can set https to an object for custom options. Possible options:

  • domains: (Array) Default is ['localhost', '127.0.0.1', '::1'].
  • validityDays: (Number) Default is 1.

User-Provided Certificate

Set https: { cert, key } where the cert and key are paths to the SSL certificates. With an encrypted private key, you also need to set passphrase on the https object.

To provide a certificate stored in a keystore set https: { pfx } with a path to the keystore. When the keystore is password protected also set passphrase.

You can also provide an inline cert and key instead of reading from the filesystem. In this case, they should start with --.

showURL

  • Default: true (force disabled on a test environment)

Show a CLI message for the listening URL.

baseURL

  • Default: /

open

  • Default: false (force disabled on test and production environments)

Open the URL in the browser. Silently ignores errors.

clipboard

  • Default: false (force disabled on test and production environments)

Copy the URL to the clipboard. Silently ignores errors.

isTest

  • Default: process.env.NODE_ENV === 'test'

Detect if running in a test environment to disable some features.

autoClose

  • Default: true

Automatically close when an exit event, SIGTERM, SIGINT or SIGHUP signal is received in the process.

publicURL

  • Default: (the first public URL listening)

The public URL to show in the CLI output

qr

  • Default: true

Print QR Code for public address.

public

  • Default: false for development or when hostname is localhost and true for production

When enabled, listhen tries to listen to all network interfaces. You can also enable this option using --host CLI flag.

ws

  • Default: false

Enable experimental WebSocket support using unjs/crossws or node upgrade handler.

Option can be a function for Node.js upgrade handler ((req, head) => void) or an Object to use CrossWS Hooks.

When using dev server CLI, you can easily use --ws and a named export called websocket to define CrossWS Hooks with HMR support!

License

Published under the MIT license. Made by @pi0 and community πŸ’›


πŸ€– auto updated with automd

listhen's People

Contributors

0xflotus avatar aaharu avatar aareksio avatar antfu avatar atinux avatar changjoo-park avatar danielroe avatar farnabaz avatar genu avatar kampouse avatar kazupon avatar louis-tian avatar markthree avatar mrkswrnr avatar pi0 avatar renovate[bot] avatar stafyniaksacha avatar techgenius7777 avatar timursaurus avatar zenthae avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

listhen's Issues

ERROR ParseError: C:\: Support for the experimental syntax 'importAttributes' isn't currently enabled

Environment

OS: Windows 11
Node version: v20.10.0
Package manager: [email protected]

Reproduction

app.ts

import { createApp, createRouter, defineEventHandler } from 'h3'

export const app = createApp()

const router = createRouter()

app.use(router)

router.get('/authorize', defineEventHandler(async () => {
	return '<h1>Hello</h1>'
}))

Describe the bug

When I run the command :

listhen -w --open ./app.ts

I have that error :

 ERROR  ParseError: C:\: Support for the experimental syntax 'importAttributes' isn't currently enabled (250:105):          listhen 15:38:49



Add @babel/plugin-syntax-import-attributes (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-attributes) to the 'plugins' section of your Babel config to enable parsing.
 C:/path/to/app/node_modules/.pnpm/@[email protected]/node_modules/@poppinss/utils/build/index.js:250:104        



  Add @babel/plugin-syntax-import-attributes (https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-attributes) to the 'plugins' section of your Babel config to enable parsing.
  C:/path/to/app/node_modules/.pnpm/@[email protected]/node_modules/@poppinss/utils/build/index.js:250:104       
  at C:/path/to/app/node_modules/.pnpm/[email protected]/node_modules/edge.js/build/index.js:17:14
  at C:/path/to/app/app.ts:1:171

Additional context

No response

Logs

No response

Doesn't seem to work with ViteDevServer

Minimal reproduction:

const { createServer } = require("vite");
const { listen } = require("listhen");

(async function main() {
  listen(await createServer());
})();

Output:

ViteDevServer.app is deprecated. Use ViteDevServer.middlewares instead.

  > Local:    http://localhost:4000/ 
  > Network:  http://192.168.1.203:4000/
  > Network:  http://192.168.86.31:4000/

Attempts to open http://localhost:4000/ hang forever. Trying listen((await createServer()).middlewares) also doesn't work.

Support http server options when creating server instance

Describe the feature

My problem directly is that there is no way to modify the highWaterMark setting for server responses.
This means that responses are chunked per 16k bytes.
The only point you can change this is at the moment of server creation, by either modifying the highWaterMark option (which affects the incomming messages buffering as well) or by specifying an alternate class for the ServerResponse which could wrap the default and modify the highWaterMark field as it is passed in/on.

Docs: https://nodejs.org/api/http.html#httpcreateserveroptions-requestlistener

The point of all of this is to build a server that can respond in small chunk sizes when, for example, exposing a response as a continuous stream of (small) data.

Additional information

  • Would you be willing to help implement this feature?

Segmentation fault when running in watch mode in Node 20.12.x or greater

Environment

Software Version
NodeJS v20.12.2
Operating System Pop!_OS 22.04 LTS
Listhen v1.7.2

Reproduction

https://github.com/joshmossas/listhen-watch-segfault

Describe the bug

Running listhen in watch mode causes you to get the following error:

Segmentation fault (core dumped)
 ELIFECYCLE  Command failed with exit code 139.

This is true if you use the cli (listhen ./my-file.ts --watch) or if you call listenAndWatch() directly.

Additional context

Downgrading to NodeJS v20.11.1 causes everything to run normally.

I haven't tried to reproduce on other operating systems. So I can only confirm that this is happening in Linux.

Logs

No response

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/autofix.yml
  • actions/checkout v4
  • actions/setup-node v4
  • autofix-ci/action ea32e3a12414e6d3183163c3424a7d7a8631ad84
.github/workflows/ci.yml
  • actions/checkout v4
  • actions/setup-node v4
  • codecov/codecov-action v4
npm
package.json
  • @parcel/watcher ^2.4.1
  • @parcel/watcher-wasm ^2.4.1
  • citty ^0.1.6
  • clipboardy ^4.0.0
  • consola ^3.2.3
  • crossws ^0.2.4
  • defu ^6.1.4
  • get-port-please ^3.1.2
  • h3 ^1.11.1
  • http-shutdown ^1.2.2
  • jiti ^1.21.0
  • mlly ^1.6.1
  • node-forge ^1.3.1
  • pathe ^1.1.2
  • std-env ^3.7.0
  • ufo ^1.4.0
  • untun ^0.1.3
  • uqr ^0.1.2
  • @types/node ^20.11.27
  • @types/node-forge ^1.3.11
  • @vitest/coverage-v8 ^1.3.1
  • automd ^0.3.6
  • changelogen ^0.5.5
  • eslint ^8.57.0
  • eslint-config-unjs ^0.2.1
  • ip-regex ^5.0.0
  • prettier ^3.2.5
  • typescript ^5.4.2
  • unbuild ^2.0.0
  • vitest ^1.3.1
  • pnpm 8.15.4
playground/package.json
  • h3 ^1.11.1
  • listhen ^1.7.2

  • Check this box to trigger a request for Renovate to run again on this repository

Disable public listhen by default in dev

In development mode, while it is a useful feature to listhen on public ips, it can also be a security risk. We shall disable it by default with a hint to how optionally enable.

listhen doesn't work on windows

Environment

package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "listhen -w ./index.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.18.2"
  },
  "devDependencies": {
    "listhen": "^1.5.5"
  }
}

Reproduction

https://stackblitz.com/edit/stackblitz-starters-k5vsiz?file=index.js

But stackblitz run programs on linux so it works

Describe the bug

When I run npm run dev on ubuntu it works, but not when I do it on windows

Additional context

Here is my index.js code

import express from 'express'

const app = express()

app.get('/', (_, res) => {
    res.send('Hello World!')
})

export default app

Logs

[12:04:57]  ERROR  Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

  at new NodeError (node:internal/errors:405:5)
  at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:136:11)
  at defaultLoad (node:internal/modules/esm/load:87:3)
  at nextLoad (node:internal/modules/esm/loader:163:28)
  at ESMLoader.load (node:internal/modules/esm/loader:603:26)
  at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
  at new ModuleJob (node:internal/modules/esm/module_job:64:26)
  at #createModuleJob (node:internal/modules/esm/loader:480:17)
  at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)



[12:04:57]  ERROR  Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Invalid handler. It should be a function

Environment

h3 1.8.0-rc.2 and 1.8.0-rc.3
OSX, with pnpm 8.6

Reproduction

https://stackblitz.com/edit/github-uqdf6b?file=package.json

Describe the bug

The issue occurred when I tried to illustrate a feature request.

When I use listhen since h3 was added with the rc version (the 2nd), I got this following issue:

ERROR Invalid handler. It should be a function:

Code:

app.use(
  '/api',
  eventHandler((event) =>
    proxyRequest(event, join(BACKEND_ENDPOINT, event.path))
  )
);

Additional context

According to the error message, it is linked with fromNodeMiddleware.

Here the trace from the function (in h3):

    at fromNodeMiddleware (file:///Users/micheledighofffer/DEV/listhen/node_modules/.pnpm/[email protected]/node_modules/h3/dist/index.mjs:1840:31)
    at loadHandle (file:///Users/micheledighofffer/DEV/listhen/dist/index.mjs:892:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async listenAndWatch (file:///Users/micheledighofffer/DEV/listhen/dist/index.mjs:998:3)
    at async Object.run (file:///Users/micheledighofffer/DEV/listhen/dist/cli.mjs:91:7)
    at async runCommand (file:///Users/micheledighofffer/DEV/listhen/node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:313:5)
    at async runMain (file:///Users/micheledighofffer/DEV/listhen/node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:425:7)

The function is called by listhen even it's not use in the app.

It seems that the type is not the one expected and doesn't match the change made by @danielroe (7e9570)
The handler type is not function but object.

Logs

No response

serve static support

Listhen provides lots of DX features for a nice listener. It could be a nice addition for supporting static asset serving and including some options for SPA fallback (https://github.com/nuxt/framework/discussions/7550).

It could be via another unjs package but since aim of listhen is not minimizing dependencies and currently has many of them, adding directly to same package makes sense to me.

nested h3 apps should inherit options

We create a dedicated app instance in listhen and then wrap it. In this case, any custom user options will be discarded. (mainly - onError handler)

Capturing H3 errors

Environment

os: linux mint
nodejs: v20.8.1
listhen: ^1.7.2
h3: ^1.11.1

Reproduction

https://gist.github.com/nainemom/93650c8efe74714e0fb6ba4193adc2f5

Describe the bug

onError prop on h3 app never reaches when the app started by listhen.

Additional context

I tried to use onError prop on h3 app object to capture my application error, however it doesn't run my error handler function at all. at first, I thought that it may be the h3 bug, but after few more tests, i realized that it's actually related to listhen.

In the reproduction gist, i created two script, one of them starts the app with listhen and the other one just start the app with nodejs itself and create web server with nodejs http module.
The app itself is so simple, just a simple /error route to throw an error.
Now if you try to use listhen to start the app, the error handler method never reaches, but with node it just works.

I also thought that it may tty mapping problem, but it seems not.

Logs

No response

feat: persist generated https certificates

Describe the feature

When using self-signed generated certificates for local development, every time you restart listhen (or in my case restart the nuxt dev server), a new certificate is generated and your browser's "Your connection is not private" page must be explicitly bypassed.

As a small optimization, it would be very nice if the generated certificates were (maybe optionally) persisted to disk so that you only need to manually bypass the browser's insecure warning page once (or each time a new certificate is generated). This is similar to how @vitejs/plugin-basic-ssl works by saving the cert inside of a hidden temp dir in your project's node_modules directory (./node_modules/.vite/basic-ssl).

I could see listhen doing something similar by persisting the certs at ./node_modules/.listhen/certs.

I'm not sure if this has security implications or may be unreliable depending on the runtime environment, so if this is impractical and/or unadvisable I completely understand. Thanks!

Additional information

  • Would you be willing to help implement this feature?

Trap SIGINT, SIGTERM, SIGHUP for autoclosing

While developing, it is common to send signals to the process.

One example is opening a terminal and executing e.g. listhen -w index.ts. To be able to use the terminal again, the program must be interrupted with Ctrl + C which sends a SIGINT to the process.

While the program is running (listhen -w index.ts) in a terminal and the terminal gets closed, then a SIGHUP is send to the process.

And when a process is killed the default sent signal is SIGTERM.

When receiving one of these signals (INT/TERM/HUP) the process's exit event will not get fired, and so, also no cleanup (close()) will be executed.

To properly auto-close on these specific signals, it's enough to fire an exit event when a signal is trapped.

Additional information

  • Would you be willing to help implement this feature?

Open the URL in the browser - uncaughtException in WSL environment

Environment

Operating System: WSL2
Node Version: v18.17.1
Package Manager: [email protected]

Reproduction

I donΒ΄t know how to create a one click reproduction for this issue since it is heavily related to WSL.

This is my WSL configuration file:

ls -al /etc/wsl.conf

-rw-r--r-- 1 root root 531 Sep 12 10:07 /etc/wsl.conf

cat /etc/wsl.conf

[network]
generateHosts = false

Describe the bug

I am coming from nuxt and I get the following error when starting the dev server:

ERROR [uncaughtException] spawn function getWslDrivesMountPoint2() {

I tried to clone this repository directly and was able to reproduce the error with the following commands:

pnpm install

pnpm play --open

I guess listhen tries to detect the wsl mount point and is somehow failing. I'm looking at the code for a while but cant figure out what exactly is going wrong.

Despite the error, everything works fine, only the browser does not open.

Additional context

No response

Logs

No response

auto generated certs cannot be used for cross site requests in chrome

Environment


  • Operating System: Darwin
  • Node Version: v20.9.0
  • Nuxt Version: -
  • CLI Version: 3.10.0
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

  • Serve a nitro server over https using:
npx nitropack dev --host --https`
  • Generate certificates in root folder of Vite powered web app with:
rm -rf .cert && mkdir -p .cert && mkcert -key-file ./.cert/key.pem -cert-file ./.cert/cert.pem 'localhost'
  • Serve a Vue app over https with the following vite configuration:
const getSecureCertificates = () => {
  try {
    return {
      key: readFileSync('./.cert/key.pem'),
      cert: readFileSync('./.cert/cert.pem')
    }
  } catch (error) {
    console.warn('No secure certificates found. Running in insecure mode.')
  }
}
server: {
    port: 3011,
    ...((mode.toLocaleLowerCase() === 'development' || command !== 'build') && {
      https: getSecureCertificates()
    }),
  • Make a request from web app to the server, and receive net::ERR_CERT_AUTHORITY_INVALID

Describe the bug

Essentially, the certificate generate from using the --https flag is not really good enough for development.

Additional context

No response

Logs

No response

Shutdown strategy

In development, we can easily be stuck due to keep-alive:

Screenshot_2020-12-07_at_17.34.28.png

If would be nice to integrate http-shutdown for faster shutting down without having to force close the connections.

WebSocket hooks don't fire when using the exported `listen` function from Listhen

Environment

NodeJS - v20.11.1
H3 - v1.11.1

Reproduction

https://github.com/joshmossas/h3-ws-listhen-bug

Describe the bug

If you start an h3 server like so:

listen(toNodeListener(app), {
  ws: true,
  public: true,
});

None of the websocket hooks in defineWebSocketHandler will fire. Oddly enough, clients are still able to connect and send messages. So listhen is upgrading the connection, but for some reason none of the hooks go off meaning you can't actually send messages back.

If you refactor the code to use the listhen cli. It starts working again:

// index.ts
export default app;
listhen ./index.ts --ws --public

Additional context

I'm unsure if the bug is happening on the H3 side or the Listhen side. I did try digging through both code bases for a while and couldn't figure out what was causing this behavior.

Logs

No response

Support JSX/TSX

Environment

  • Operating System: Darwin
  • Node Version: v18.16.0
  • Package Manager: [email protected]
  • h3 version: 1.8.0
  • listhen version: 1.3.0

Reproduction

I create a stackblitz project https://stackblitz.com/github/kiwilan/feedrender

But to have better reproduction, just clone repository

git clone https://github.com/kiwilan/feedrender.git
cd feed-renderer
pnpm i
pnpm dev

Describe the bug

When we use pnpm dev shortcut for listhen -w ./src/index.ts, the output will be

 ERROR  Cannot find module './podcast-renderer'                                                                                                                           listhen 1:44:09 PM
Require stack:
- ./feed-render/src/react/index.ts

  - ./src/react/index.ts
  at ./src/react/index.ts:1:309
  at ./src/models/Podcast.ts:2:14

The error comes from src/react/index.ts with an import

import PodcastRenderer from './podcast-renderer'

The file is src/react/podcast-renderer.tsx, a simple React file.

Alternative

If I use tsx with...

pnpm dev:node

...everything works.

So I think listhen could have a problem with React import with -w flag?

Build

When I build app with tsup

pnpm build
pnpm start

I have no error and React component is correctly imported.

Additional context

Error import could have another origin but I try many solutions and listhen could be cause.

Logs

No response

Only URLs with a scheme in: file, data are supported by the default ESM loader.

Environment

  • OS: Win11
  • Node version: 20.6.1
  • Package Manager: [email protected]
  • h3 version: 1.8.1
  • listhen version: 1.5.5

Reproduction

Hi, You can clone this repository:

git clone https://github.com/OTTIN-T/h3Error
cd h3Error
pnpm i
pnpm dev

Describe the bug

When we use pnpm dev shortcut for listhen -w ./app.ts, the output will be:

ERROR  Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'd:'

  at new NodeError (node:internal/errors:405:5)
  at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:207:11)
  at defaultLoad (node:internal/modules/esm/load:113:3)
  at ModuleLoader.load (node:internal/modules/esm/loader:388:13)
  at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:270:56)
  at new ModuleJob (node:internal/modules/esm/module_job:65:26)
  at #createModuleJob (node:internal/modules/esm/loader:282:17)
  at ModuleLoader.getJobFromResolveResult (node:internal/modules/esm/loader:240:34)
  at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:221:17)
  at async ModuleLoader.import (node:internal/modules/esm/loader:307:23)

Received protocol 'd:' is the name of my disk, but it's the same if it's on C:

Additional context

I found a similar issue ont he playwright repository.

I've located the error that seems to come from the createDevServer method in the index.mjs file in the listhen dist folder.

We can find this inside:

async function createDevServer(entry, options) {
  const logger = options.logger || consola.withTag("listhen");
  const h3Entry = await resolvePath("h3", {
    url: [options.cwd, process.cwd(), import.meta.url].filter(Boolean)
  });

  const {
    createApp,
    fromNodeMiddleware,
    serveStatic,
    eventHandler,
    dynamicEventHandler,
    toNodeListener
  } = await import(h3Entry);
  
[...]

If I follow the solution found on playwright by doing something like this:

import url from 'url';
[...]

async function createDevServer(entry, options) {
  const logger = options.logger || consola.withTag("listhen");
  const h3Entry = await resolvePath("h3", {
    url: [options.cwd, process.cwd(), import.meta.url].filter(Boolean)
  });

  const {
    createApp,
    fromNodeMiddleware,
    serveStatic,
    eventHandler,
    dynamicEventHandler,
    toNodeListener
  } = await import(url.pathToFileURL(h3Entry));
  
  [...]

(I only add url.pathToFileURL(h3Entry) to the import)

Everything seems to be working perfectly πŸš€

Thank you in advance.

Logs

No response

Cannot find port when running `listen` with IPX

Environment

MacBook Pro M1 Pro 32GB
macOS Sonoma 14.0

IPX: 2.0.0
Node: 18.18.0

Reproduction

https://codesandbox.io/p/sandbox/listhen-repro-pxcqwx

Describe the bug

When running listen with only a simple IPX node server, listen cannot find port 3000 for some reason.
It first starts at port 3000 but then gets an error saying it cannot find an exported entrypoint in index.ts. It then starts again on port 3001, because it says port 3000 is not available.

CleanShot 2023-10-31 at 14 49 18

Additional context

No response

Logs

$ listhen -w ./index.ts

  ➜ Local:    http://localhost:3000/
  ➜ Network:  use --host to expose

πŸ“ Serving static files from ./public                       listhen 1:47:03 PM
πŸš€ Loading server entry ./index.ts                          listhen 1:47:03 PM

[listhen 1:47:04 PM]  ERROR  Make sure your server entrypoint exports a compatible handler, handle, app or default function export.



[get-port] Unable to find an available port (tried 3000-3100 on any host). Using alternative port 3001

  ➜ Local:    http://localhost:3001/
  ➜ Network:  use --host to expose

πŸ‘€ Watching ./ for changes                                  listhen 1:47:04 PM

Version 1.1.2 has compatibility issues with the consola plugin

Environment

14.21

Reproduction

no need

Describe the bug

hi,
I'm using this plugin that nuxt-windicss depends on,my consola.js version is 3.1.0, when i run my project, i get this error:
Package subpath './utils' is not defined by "exports" in D:\code\enterprise-front-ui\node_modules\consola\package.json imported from D:\code\enterprise-front-ui\node_modules\listhen\dist\index.mjs
it seems 3.1.0 version not exports utils.js ,I solved this problem by upgrading the version to 3.2.3, I hope it can be compatible to prevent other people from having this error, thank you so much!

Additional context

No response

Logs

No response

πŸ‘€ Cannot start the watcher!

Have you seen this issue with the dev server and come here? You are in the right place!

We have recently introduced experimental dev server functionality to Listhen powered by parcel-bundler/watcher.

Please report any error here if you have occurred πŸ™πŸΌ

(this issue is temporarily open for a while)

Disable QR code for stackblitz

(shared by @manniL in a private discussion)

We added a QR code to the listhen banner a while ago as a DX enhancement also enabled it for stackblitz. And I used it for several times in order to test my sandbox on phone.

Do you belive it is an extra feature? We might think to remove it since was experimental anyway.

(waiting for feedbacks for a while on this issue)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.