Skip to content

Support Node.js Compile Cache #371

Description

@lishaduck

Here's some sample code from Nuxt:

import nodeModule from "node:module"

// https://nodejs.org/api/module.html#moduleenablecompilecachecachedir
// https://github.com/nodejs/node/pull/54501
if (nodeModule.enableCompileCache && !process.env.NODE_DISABLE_COMPILE_CACHE) {
  try {
    const { directory } = nodeModule.enableCompileCache()
    if (directory) {
      // allow child process to share the same cache directory
      process.env.NODE_COMPILE_CACHE ||= directory
    }
  }
  catch {
    // Ignore errors
  }
}

We could add something similar to bin/elm-review to make Node cache the v8 bytecode between runs.
I don't think our dynamic Elm loading should cause any problems, despite whatever shenanigans we use (I frankly don't remember if we special case anything in there)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions