neonious / lowjs

A port of Node.JS with far lower system requirements. Community version for POSIX systems such as Linux, uClinux or Mac OS X.
http://www.lowjs.org/
Other
1.27k stars 72 forks source link

package.json main script require #113

Closed algj closed 3 years ago

algj commented 4 years ago

Some node modules have in package.json "main" parameter which basically says which script to execute.

For example, people often put the entry point to lib/index.js or lib/.js, in this case the corresponding script must be described as main in package.json.

Example of package.json:

{
  "license": "BSD-3-Clause",
  "main": "src/index.js",
  "name": "packageName",
  "repository": {
    "type": "git",
    "url": "git://github.com/example/example.git"
  },
  "scripts": {
    "fix": "standard --fix",
    "lint": "standard",
    "prepare": "npm install require-self && require-self",
    "test": "mocha --recursive --reporter spec --exit"
  },
  "version": "1.13.0"
}

About it more: https://stackoverflow.com/questions/22512992/node-js-package-json-main-parameter

ThomasRogg commented 4 years ago

OK. But what exactly is wrong with low.js regarding this? Where is the bug?

algj commented 4 years ago

OK. But what exactly is wrong with low.js regarding this? Where is the bug?

Low.js does not read package.json, that means it won't work on some packages which doesn't have "index.js". Well, people could manually write index.js files to route it to correct location/file but this is a hacky solution.

ThomasRogg commented 4 years ago

It does read package.json, see src/low_module.cpp. Do you have an exact example where this does not work?