1.0.3 • Published 6 years ago

slash-node-modules-loader v1.0.3

Weekly downloads
9
License
ISC
Repository
-
Last release
6 years ago

Slash Node Modules Loader

This module rewrites paths during require() so that if it sees a prefix of '/node_modules/' it is removed.

Example usage:

node -r slash-node-modules-loader ./index.js
// in index.js

const path = require('/node_modules/path');
const express = require('/node_modules/express');
const request = require('express');

It also works with esm for ES Modules.

node -r esm -r slash-node-modules-loader ./index.js
// in index.js

import HTMLElementPlus from '/node_modules/HTMLElementPlus';

The purpose of this is to allow ES Modules to be used isomorphicly by exposing '/node_modules/' as a route on the server. So any packages from npm can be used on the client and server without needing to use proxy modules.

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago