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

@eeharumt/fivem-typescript-sourcemap

v1.0.1

Published

TypeScript source map support library for FiveM development

Downloads

29

Readme

FiveM TypeScript Source Map Support

A source map support library for FiveM resources, enabling accurate TypeScript debugging with proper stack traces.

Installation

Package Installation

# Using pnpm (recommended)
pnpm add @eeharumt/fivem-typescript-sourcemap

# Using npm
npm install @eeharumt/fivem-typescript-sourcemap

Basic Usage

Add the following to the top of your main server/client entry file:

// src/server/index.ts
import { initializeSourceMapSupport } from '@eeharumt/fivem-typescript-sourcemap';

// Initialize source map support
initializeSourceMapSupport({ debug: true });

// Your code continues here...
console.log('Server starting');

FiveM Configuration

Add the following to your fxmanifest.lua:

-- Include source map files for debugging
files {
    'build/server/**/*.js.map',
    'build/client/**/*.js.map'
}

Configuration

TypeScript Configuration

Ensure your tsconfig.json includes proper source map settings:

{
  "compilerOptions": {
    "sourceMap": true,
    "inlineSourceMap": false,
    "sourceRoot": "../src",
    "outDir": "./build"
  }
}

Complete FiveM Manifest Example

fx_version 'cerulean'
game 'gta5'

server_scripts { 'build/server/**/*.js' }
client_scripts { 'build/client/**/*.js' }

-- Essential: Include source map files
files {
    'build/server/**/*.js.map',
    'build/client/**/*.js.map'
}

Stack Trace Comparison

Before (Compiled JavaScript)

Error: Custom error message
    at throwError (@your-resource/build/server/index.js:45:11)
    at Object.callback (@your-resource/build/server/index.js:78:17)

After (Original TypeScript)

Error: Custom error message
    at throwError (src/server/index.ts:120:11)    ← TypeScript file!
    at <anonymous> (src/server/index.ts:156:17)   ← Accurate line numbers!

API Reference

initializeSourceMapSupport(options?)

Initializes source map support for the current resource.

import { initializeSourceMapSupport } from '@eeharumt/fivem-typescript-sourcemap';

// Basic initialization
initializeSourceMapSupport();

// With debug mode enabled
initializeSourceMapSupport({ debug: true });

Options:

  • debug (boolean): Enable detailed logging for troubleshooting

enableDebugMode() / disableDebugMode()

Toggle debug mode at runtime:

import { enableDebugMode, disableDebugMode } from '@eeharumt/fivem-typescript-sourcemap';

enableDebugMode();  // Enable detailed logging
disableDebugMode(); // Disable detailed logging

clearSourceMapCache()

Clear the internal source map cache:

import { clearSourceMapCache } from '@eeharumt/fivem-typescript-sourcemap';

clearSourceMapCache(); // Useful during development hot-reloading

Testing

You can test the source map functionality with this command:

RegisterCommand('test-sourcemap', () => {
  try {
    const testFunction = () => {
      throw new Error('Source map test error');
    };
    testFunction();
  } catch (error) {
    console.error('Stack trace (should show TypeScript line numbers):');
    console.error(error.stack);
  }
}, false);

Troubleshooting

Source Maps Not Working

  1. Check fxmanifest.lua:

    files {
        'build/**/*.js.map'  -- Ensure this is included
    }
  2. Verify TypeScript Build:

    # Check if .js.map files are generated
    ls -la build/server/*.js.map
  3. Enable Debug Mode:

    initializeSourceMapSupport({ debug: true });

Common Issues

| Issue | Solution | |-------|----------| | Incorrect line numbers | Check sourceRoot configuration in tsconfig.json | | Wrong file paths | Verify files configuration in fxmanifest.lua | | Performance issues | Use debug: false in production environments |

Requirements

  • FiveM Server/Client
  • TypeScript project with source maps enabled
  • Node.js modules support in your resource

License

MIT License - see LICENSE file for details.