New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fivem-source-map-support

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fivem-source-map-support

FiveM JavaScript source maps support

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

Information

Writed from scratch, but some of code based on node-source-map-support

This package provides ability to use JavaScript (e.g. TypeScript) source-maps both on server and client-side.
FxDK is supported too.

Note
Package was not tested on any a bit large project (because i don't have one), so i would appreciate any information on how this works for you.

Installation and usage

Install package

$ npm install fivem-source-map-support

or

$ yarn add fivem-source-map-support

Then put this code somewhere in your project:

import SourceMapSupport from 'fivem-source-map-support'
SourceMapSupport.inject()

// or

require("fivem-source-map-support").inject()

Please, note few things:

  • This way of injecting will NOT work on client-side without module bundler because of lack import/export API.
  • If your project builds with a module bundler (esbuild for e.g.) into single file, everything will work even on the client-side.
  • On server-side you can use package in both ways, with module bundler and without.

Manual usage

You can manually use package on client-side ignoring just mentioned way:

  1. Install package or get one from Releases page
  2. Get bundle.js from node_modules/fivem-source-map-support/dist or from archive (if you downloaded release)
  3. Put bundle into your resource folder and rename if you want to (e.g. fivem-sourcemap.js)
  4. Add client_script in fxmanifest.lua on top of other scripts:
client_script "fivem-sourcemap.js"

Package will be injected automatically, no additional code required.

Tricks

For some tricky annoying reason, if your resource located in sub-directory of resources folder, for example, not resources/your-resource but resources/[core]/your-resource, you need to help package to locate directory:

import SourceMapSupport from 'fivem-source-map-support'
SourceMapSupport.inject({ subdir: '[core]' })

// or

require('fivem-source-map-support').inject({ subdir: '[core]' })

Doesn't make sense on client-side.

Limitations

Client-side supports only inline source-maps. Maps that placed in separate files will not be readed.

Keywords

FAQs

Package last updated on 18 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc