Closed littlee closed 3 years ago
./src/render.js
module.exports = { a: 1, };
build log:
> microbundle build -i ./src/render.js --no-compress --no-sourcemap -f umd --name=MyLib Build "MyLib" to dist: 129 B: my-lib.umd.js.gz 102 B: my-lib.umd.js.br
output file:
(function (factory) { typeof define === 'function' && define.amd ? define(factory) : factory(); }((function () { module.exports = { a: 1 }; })));
MyLib
but when I change my input file to a .ts file, it works
.ts
./src/render.ts
export default { a: 1};
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.MyLib = factory()); }(this, (function () { var render = { a: 1 }; return render; })));
Microbundle does not support CommonJS entry modules. Your JS version would work if you used ES Modules (this is the reason the TypeScript version worked):
export default { a: 1, }; // or export let a = 1;
./src/render.js
build log:
output file:
the output file does not export
MyLib
to globalbut when I change my input file to a
.ts
file, it works./src/render.ts