Skip to content

Offline mode #373

Closed
Closed
@gaearon

Description

@gaearon

npm wizards, we need your help!

Per @pselle’s suggestion, we should try to find a way to make create-react-app work offline.

I’m not well versed in npm flags and likely won’t have time for this, so this is a perfect opportunity for you to contribute and significantly improve the user experience of Create React App.

Here is the behavior we’re looking for:

  • Existing requirement: create-react-app my-app should use the most recent version of react-scripts if you are online. We are not changing this: we always want the users to get the most recent one.
  • New requirement: create-react-app my-app should not crash offline if you ran it at least once before. It should be able to use locally cached react-scripts in this case, if it exists.
  • Bonus: create-react-app my-app should use cached react-scripts if it knows the latest npm version is cached locally. In other words, even if you are online, we shouldn’t just refetch the whole thing if we have it locally and we know it is the latest version. This is not required but would make a big difference for most people.
  • Acceptable tradeoff: we are fine with not installing the latest transitive dependencies. In other words it’s fine if react-scripts depends on [email protected], then [email protected] comes out, but we keep using the cached [email protected].

How to achieve this? I have no idea.

Maybe this would be helpful: https://addyosmani.com/blog/using-npm-offline/.

We already use bundledDependencies (which is a bit unusual) as part of our build process so in reality react-scripts is being downloaded as a single tarball rather than through the usual npm process. Perhaps this can give us the leverage to make this better (e.g. by caching that tarball somehow).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions