esm-to-cjs
esm-to-cjs copied to clipboard
Import only is not supported
Hello, I encountered some problems while experiencing the conversion function
case 1 Import only is not supported
// input
import "lib";
// what i wanted
require("lib");
// actual:ParseError
case 2 Single and double quotation marks should be mixed
// input
import mod from "mod";
import foo from 'foo';
// what i wanted
const mod = require("mod");
const foo = require("foo");
case 3 export mix
// input
export function foo(){}
exports.bar = function (){}
// what i wanted
function foo(){}
exports.bar = function (){}
exports.foo = foo;
// actual
function foo(){}
exports.bar = function (){}
module.exports = { // covered
foo
};
Hi, I don't actively maintain this project anymore, but I'm happy to review and accept PRs.
Case 1: PR welcome, should we straightforward. Case 2: This would be a little difficult how the parser is written (it's very ad-hoc, not advised for production env; this was a tiny hobby project). Case 3: That's probably something this project shouldn't plan to support.