Skip to content

externalHelpers broken in published rust binary #11643

@Olsworn

Description

@Olsworn

Describe the bug

This is using the swc-linux-x64-gnu binary from the release page.

This is the command used:
./swc-linux-x64-gnu compile --config-file .swcrc --out-file index.js index.ts

The same command works just fine running swc through @swc/cli / @swc/core of the same version (as shown with the playground link).

Input code

export * from "./my-file";

Config

{
  "jsc": {
    "externalHelpers": false
  },
  "module": {
    "type": "commonjs"
  }
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.15.18&code=H4sIAAAAAAAAA0utKMgvKlHQUkgrys9VUNLTz63UTcvMSVWy5gIAUamOtxsAAAA%3D&config=H4sIAAAAAAAAA0WNSwrAIAwF955Csu4JeoJeQ2wKFX8kFhTx7o0ttJuQvJlHutIaHFtYdZdVDqwFKRq%2Foc9ILOAwnnF5aTbESJ8tCbdYTJUESsvIls5c4IFD5pg9CGm%2FPP4%2FpjkbNoWQouPpDzXUDc7OKjaOAAAA

SWC Info output

No response

Expected behavior

Output should be:

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
_export_star(require("./my-file"), exports);
function _export_star(from, to) {
    Object.keys(from).forEach(function(k) {
        if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
            Object.defineProperty(to, k, {
                enumerable: true,
                get: function() {
                    return from[k];
                }
            });
        }
    });
    return from;
}

Actual behavior

Output references @swc/helpers:

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
var _export_star = require("@swc/helpers/_/_export_star");
_export_star._(require("./my-file"), exports);

Version

1.15.18

Additional context

Use the binary from version v1.12.9 works with the same configuration.
It started breaking in v1.12.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions