kiliman / remix-express-vite-plugin

This package includes a Vite plugin to use in your Remix app. It configures an Express server for both development and production using TypeScript.
118 stars 6 forks source link

(ISSUE-24) Entry point loaded twice #25

Closed thomaswelton closed 3 months ago

thomaswelton commented 3 months ago

Fixes #24 Work in progress, for discussion.

Use server.moduleGraph.getModuleByUrl to load the remix entry point module.

From my testing using ssrLoadModule will cause the entry.server file to be loaded and transformed twice. The first time this module loads is by the remix plugin, and the again in this plugin.

Using the moduleGraph API we can retrieve a module from the cache without reloading it.

kiliman commented 3 months ago

Interesting. I would figure that Vite would dedupe the imports. Anyway, this looks good.

kiliman commented 3 months ago

Fixed in v0.2.7