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

Reuse modules across installed packages #3672

Closed

Description

@benogle

Currently packages are all installed to ~/.atom/packages, but since there is no package.json file or node_modules folder in ~/.atom/packages, none of the packages ever share a common module when the dependency versions match.

So if you have 10 packages that depend on ^1 of underscore-plus, 10 copies of the same underscore-plus version will be required. This dramatically affects startup time since each version can take up to 10-15ms to require.

One solution is to add a seeded cache of common package modules in ~/.atom/packages/node_modules that would be populated and maintained by apm such that apm install would also dedupe modules across packages.

Then we can just document the common modules and tell people to add something like this to their package.json file (and possibly include in apm init) if they want to use them:

"dependencies": {
  "pathwatcher": "^3",
  "underscore-plus": "^2",
  "fs-plus": "^2",
  "event-kit": "^1",
  "space-pencil": "^1"
}

This offers a nice middle-ground where we don't have to export these common modules and worry about bumping the Atom major version when one changes its major version, we can just recommend what versions packages authors bind to and control and maintain a well-tuned cache of them so that depending on them doesn't slow down your package.

Activity

  1. benogle commented on Sep 30, 2014

    @benogle
    ContributorAuthor

    Would the package cache use the same modules as core? Is that possible? So core uses pathwatcher and package X uses pathwatcher. Will it only require once?

    We could specify the versions of this cache in the core package.json:

    "packageCache": {
      "pathwatcher": "3.0.1",
      "underscore-plus": "2.1",
      "fs-plus": "2.4",
      "event-kit": "1.2.3",
      "space-pencil": "1.2.3"
    }
  2. lock commented on Jan 25, 2019

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  3. locked as resolved and limited conversation to collaborators on Jan 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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