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

hot reload modules w/ es6 modules #459

@seiyria

Description

@seiyria

Hey! @Fishrock123 pointed me here for something I was thinking about.

While I don't have a particularly large project, back when all I had was a require cache, I could clear it out to "hot reload" a file/module/chunk of code. It wasn't the best possible way to get my code running without a restart (nodemon or similar) but it worked without forcing me to do fresh restarts all the time.

I'm using Typescript these days and, with that, ES6 imports (like most are I imagine). For reference, I'm making a game but it has a few hundred files (which is probably not a lot in comparison to some larger applications), and restarting it (I'm using ts-node-dev at the moment) still takes a solid 20-30 seconds to get everything running again. I think it would be much easier if I could hotswap my code in by somehow clearing out parts of the ES6 module cache.

I realize after talking with @Fishrock123 that ES6 modules are meant to be immutable and probably for good reason, but is it possible node will allow a dev to override this issue in development environments?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions