npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nextjs-lam-plugin

v1.3.1

Published

Next.js plugin for LAM (Localhost Apps Manager) - automatically registers development servers

Readme

Next.js LAM Plugin

A Next.js plugin that automatically integrates with LAM (Localhost Apps Manager) to provide custom .local domains for your development server.

Features

  • 🚀 Automatic Registration: Automatically registers your Next.js dev server with LAM
  • 🔄 Proxy Mode: Uses LAM's proxy mode with WebSocket support for HMR
  • 🛡️ HMR Support: Configures Next.js to allow HMR from custom domains
  • 🌐 Cross-Origin Support: Automatically configures allowedDevOrigins for Next.js 15+
  • 🧹 Auto Cleanup: Automatically unregisters when the dev server stops
  • ⚙️ Flexible Configuration: Customizable LAM host, port, and proxy settings
  • 📝 TypeScript Support: Full TypeScript definitions and ES6 imports
  • Turbopack Compatible: Fully works with Next.js 16's default Turbopack bundler

Installation

npm install --save-dev nextjs-lam-plugin

Usage

Basic Setup (JavaScript)

Update your next.config.js:

const { withLam } = require('nextjs-lam-plugin');

module.exports = withLam({
  // Your Next.js config here
  reactStrictMode: true,
});

TypeScript Setup

For TypeScript projects, use ES6 imports:

import { withLam, NextJsLamPlugin } from 'nextjs-lam-plugin';

const nextConfig = withLam({
  reactStrictMode: true,
  // Your Next.js config here
});

export default nextConfig;

Or use the plugin directly:

import { NextJsLamPlugin } from 'nextjs-lam-plugin';

const nextConfig = {
  reactStrictMode: true,
  webpack: (config, options) => {
    if (options.dev) {
      config.plugins?.push(new NextJsLamPlugin({
        lamHost: 'localhost',
        lamPort: 80,
        useProxy: true
      }));
    }
    return config;
  }
};

export default nextConfig;

That's it! When you run npm run dev, the plugin will:

  1. Detect your project name from package.json
  2. Register your dev server with LAM
  3. Configure Next.js to allow HMR from your custom domain

Advanced Configuration

const { withLam } = require('nextjs-lam-plugin');

module.exports = withLam({
  // Your Next.js config
  reactStrictMode: true,
}, {
  // LAM plugin options
  lamHost: 'localhost',     // LAM server host (default: 'localhost')
  lamPort: 80,             // LAM server port (default: 80)
  projectName: 'my-app',   // Override project name (default: from package.json)
  useProxy: true           // Use proxy mode (default: true)
});

How It Works

  1. Development Mode Detection: Only runs in development mode
  2. Project Name Detection: Reads project name from package.json
  3. LAM Registration: Registers with LAM using your project name and dev server port
  4. HMR Configuration: Adds your .local domain to Next.js's allowed hosts for HMR
  5. Proxy Mode: Uses LAM's proxy mode for full WebSocket and HMR support

Example Output

When you start your dev server, you'll see:

[LAM Plugin] ✅ Registered my-app.local → localhost:3000
[LAM Plugin] 🌐 Visit: http://my-app.local
[LAM Plugin] 🔄 Mode: Proxy (with WebSocket support)

Configuration Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | lamHost | string | 'localhost' | LAM server hostname | | lamPort | number | 80 | LAM server port | | projectName | string | null | Override project name (auto-detected from package.json) | | useProxy | boolean | true | Use LAM proxy mode (recommended for HMR) |

Requirements

  • LAM Server: Must be running and accessible
  • Next.js 12+: Required for webpack 5 support
  • Development Mode: Only works in development

Troubleshooting

LAM Connection Failed

[LAM Plugin] ⚠️  Could not connect to LAM: ECONNREFUSED

Solution: Make sure LAM is running on the configured host/port.

Project Name Not Found

[LAM Plugin] Could not determine project name. Skipping LAM registration.

Solution: Add a name field to your package.json or specify projectName in options.

HMR Not Working

Make sure you're using proxy mode (useProxy: true) and that your .local domain is properly configured in your hosts file.

Cross-Origin Request Warning (Next.js 15+)

⚠ Cross origin request detected from my-app.local to /_next/* resource. In a future major version of Next.js, you will need to explicitly configure "allowedDevOrigins" in next.config to allow this.

Solution: The plugin automatically configures allowedDevOrigins for you. If you're still seeing this warning, make sure you're using the withLam helper function:

const { withLam } = require('nextjs-lam-plugin');

module.exports = withLam({
  // Your Next.js config
  reactStrictMode: true,
});

The plugin automatically adds your .local domain to allowedDevOrigins to prevent cross-origin issues.

Turbopack Error (Next.js 16)

⚠ Invalid next.config.ts options detected:
⚠     Expected object, received function at "turbopack"

Solution: The plugin is fully compatible with Turbopack. The error occurs because Next.js expects turbopack to be an object, not a function. The withLam helper automatically handles this correctly.

If you see this error, ensure you're using the withLam helper:

const { withLam } = require('nextjs-lam-plugin');

module.exports = withLam({
  reactStrictMode: true,
  // turbopack config is handled automatically
});

The plugin works seamlessly with both webpack and Turbopack without any additional configuration!

Manual Plugin Usage

If you prefer not to use the withLam helper:

const NextJsLamPlugin = require('nextjs-lam-plugin');

module.exports = {
  webpack: (config, options) => {
    if (options.dev) {
      config.plugins.push(new NextJsLamPlugin({
        lamHost: 'localhost',
        lamPort: 80,
        useProxy: true
      }));
    }
    return config;
  }
};

License

MIT