Skip to content
This repository was archived by the owner on Mar 25, 2018. It is now read-only.
This repository was archived by the owner on Mar 25, 2018. It is now read-only.

get rid of package.json "main" field lookup in module loader #16

@rlidwka

Description

@rlidwka

Related to ES6 modules, #5, and following a lengthy discussion in npm/npm#8222. Obviously, I'm not talking about require() here, changing it would be insane. But since ES6 module loader would be completely different, we might as well consider to get rid of that. That's why:

  • the name of the file package.json doesn't make sense anymore with ES6 modules, because it's a CommonJS name
  • this file itself conflicts with ASP.NET (Consider renaming package.json in the next major version (3.0) npm/npm#8222), and other package manager for C (can't find the link and "C" keyword is something pretty hard to search for) update: it's clib
  • this is an extra disk read each time something is required. Not a lot, but since module loading happens every time on startup, every bit counts
  • if we implement it in new loader, it'll become a standard and have to be implemented in all module loaders (e.g. browserify, nexe, etc.), therefore increasing maintenance burden on the entire community
  • there is an idea to move all config files in .config (.config/package.json npm/npm#8159), and this implicit dependency in all loaders only makes it harder

Instead of this, I suggest everyone to just use /index.js in ES6 modules. Maybe use /lib/index.js as a fallback (since most of the packages define "main": "lib/index.js" anyway, but I'm not sure if it's worth it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions