JSPM

npmluau

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34
  • Score
    100M100P100Q66848F
  • License MIT

A utility package to use npm for Luau projects

Package Exports

  • npmluau
  • npmluau/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npmluau) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

checks version GitHub top language license npm

npmluau

This utility can be used to allow Luau projects to use npm as a package manager. It lets your projects use string requires: use relative file paths for the project's files or prefix your dependency names with @pkg to use them.

If you are interested to know why should use npm for Luau development, read Why You Should Use npm for Luau.

If you are developing on a platform that does not support requires with, you can use a tool like darklua to automatically convert requires into your platform specific implementation.

How to use

Add npmluau in your dev-dependencies:

yarn add --dev npmluau

Or if you are using npm:

npm install --save-dev npmluau

In your Luau project package.json file, add a prepare script to run npmluau:

  "scripts": {
    "prepare": "npmluau",
  }

How it works

This utility will generate a folder named .luau-aliases inside node_modules after installing your dependencies that contains module links to each dependency.

Luau-lsp:

If you using the VS code extension, you can define a directory alias in your .luaurc:

{
  "aliases": {
    "pkg": "node_modules/.luau-aliases"
  }
}

License

This project is available under the MIT license. See LICENSE.txt for details.