fix(vite): empty commonjs files with only __esModule (#3540)
When modules only contain the `__esModule` flag, we still need to add the `exports` and `module.exports` initializers.
This commit is contained in:
@@ -134,7 +134,7 @@ export function cjsPlugin(
|
||||
);
|
||||
}
|
||||
|
||||
if (exported.size > 0 || exportedNs.size > 0) {
|
||||
if (exported.size > 0 || exportedNs.size > 0 || hasEsModule) {
|
||||
path.unshiftContainer(
|
||||
"body",
|
||||
t.expressionStatement(
|
||||
|
||||
Reference in New Issue
Block a user