#!/usr/bin/env node
|
|
const fs = require('fs');
|
const path = require('path');
|
const Module = require('module');
|
|
const bundlePath = path.join(__dirname, 'bundle', 'index.cjs');
|
const source = fs.readFileSync(bundlePath, 'utf8');
|
const bundledModule = new Module(bundlePath);
|
|
bundledModule.filename = bundlePath;
|
bundledModule.id = '.';
|
bundledModule.paths = Module._nodeModulePaths(path.dirname(bundlePath));
|
Module._cache[bundlePath] = bundledModule;
|
process.mainModule = bundledModule;
|
require.main = bundledModule;
|
|
bundledModule._compile(source, bundlePath);
|