esm-iso
An esm companion for isomorphic JS modules.
node -r esm -r esm-iso server.js
Examples
Try out the live demo with its example code.
The summary is explained in here:
;; // used to redirect client callsconst redirect = Object; const app = ;app;app; ;module;
You can use similar approach to also load any other module file:
Alternatives
If you want a more explicit version that uses /node_modules/
instead of /m/
as both client and server loader, you can check slash-node-modules-loader out: same loader, but with a more semantic absolute path.