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

@smapped-traces/nextjs

v0.1.2

Published

Next.js source map collection for smapped-traces

Downloads

163

Readme

@smapped-traces/nextjs

Next.js plugin for build-time source map collection and upload.

Installation

npm install smapped-traces @smapped-traces/nextjs @smapped-traces/sqlite

Usage

Wrap your Next.js config with withSourceMaps() and provide a store factory:

Local SQLite store

// next.config.mjs
import { withSourceMaps } from "@smapped-traces/nextjs";
import { createSqliteStore } from "@smapped-traces/sqlite";
import { join } from "node:path";

export default withSourceMaps(
  {
    // your Next.js config
  },
  {
    store: (distDir) => createSqliteStore(join(distDir, "sourcemaps.db")),
  }
);

Remote HTTP store

Deploy a storage service separately (see the root README for details), then point the build at it:

// next.config.mjs
import { withSourceMaps } from "@smapped-traces/nextjs";
import { createHttpStore } from "smapped-traces/store";

export default withSourceMaps(
  {
    // your Next.js config
  },
  {
    store: () => createHttpStore("https://sourcemaps.internal"),
  }
);

S3 store

npm install @smapped-traces/s3 @aws-sdk/client-s3
// next.config.mjs
import { withSourceMaps } from "@smapped-traces/nextjs";
import { S3Client } from "@aws-sdk/client-s3";
import { createS3Store } from "@smapped-traces/s3";

export default withSourceMaps(
  {
    // your Next.js config
  },
  {
    store: () =>
      createS3Store({
        client: new S3Client({ region: "us-east-1" }),
        bucket: "my-sourcemaps",
        prefix: "sourcemaps/",
      }),
  }
);

Options

withSourceMaps(nextConfig, options) accepts a SourceMapOptions object:

| Option | Type | Required | Description | | --- | --- | --- | --- | | store | (distDir: string) => SourceMapStore \| Promise<SourceMapStore> | Yes | Factory that creates a source map store. Called during the post-build hook with the build output directory (e.g. .next). | | replaceTurbopackSourcePrefix | `${string}://${string}` \| "" | No | URL prefix to replace the turbopack:///[project]/ prefix in source map paths. For example, "file:///" rewrites turbopack:///[project]/src/app.ts to file:///src/app.ts. |

What it does

Calling withSourceMaps() applies the following changes to your Next.js config:

  1. Enables Turbopack debug IDs (turbopack.debugIds = true)
  2. Enables production browser source maps (productionBrowserSourceMaps = true)
  3. Registers a runAfterProductionCompile hook that:
    • Globs for all .js.map, .mjs.map, and .cjs.map files in the build output
    • Parses each source map and extracts its debugId
    • Optionally rewrites Turbopack source prefixes
    • Uploads the source map to the provided store via store.put(debugId, content)
    • Deletes the .map files from the build output so they are not deployed

Any existing runAfterProductionCompile hook is preserved and called after source map collection completes.

Requirements

  • Next.js 16+ (uses the runAfterProductionCompile compiler hook)

License

Apache-2.0