WebReflection / asbundle

A minimalistic JS bundler
ISC License
78 stars 3 forks source link

ES module without default member doesn't work #22

Closed manix closed 4 years ago

manix commented 4 years ago

I have a transpiled file that exports a bunch of members, without itself having a default one.

Original code:

export { submodule1, submodule2, ..., submodulen };

Transpiled code:

Object.defineProperty(exports, "__esModule", { value: true });
exports.submodule1 = submodule1.default;
exports.submodule2 = submodule2.default;
exports.submodulen = submodulen.default;

Then when I try to pack the transpiled version asbundle returns { default: undefined } for that module, which doesn't seem right.

Am I doing something wrong?

WebReflection commented 4 years ago

Am I doing something wrong?

I don't know, there's nothing in here that helps replicating the issue, and the test included in this report just works without issues.

The transpiled code also looks fine, but the main issue is this sentence:

Then when I try to pack the transpiled version asbundle ....

You don't pack the transpiled version, you just asbundle esm/source.js output.js and it does everything for you.

If you put other tools in between you don't need asbundle.

Closing until more details or evidences are provided.