module-rewriter

0.1.2 • Public • Published

Rewrites ESM import paths. Powered by Web Assembly via prsr.

Usage

import build from 'module-rewriter';

const resolve = (importee, importer) => {
  // importee is from import/export, importer is the current file
  // TODO: this is a terrible resolver, don't do this
  return `/node_modules/${importee}/index.js`;
};

build(resolve).then((rewriter) => {
  const s = rewriter('input.js');
  s.pipe(process.stdout);
});

Try out demo.js in the repo or NPM install.

Readme

Keywords

none

Package Sidebar

Install

npm i module-rewriter

Weekly Downloads

1

Version

0.1.2

License

Apache-2.0

Unpacked Size

34.5 kB

Total Files

8

Last publish

Collaborators

  • samthor