Skip to content

Compiler/bundler breaks formatting of foreging module code. #4124

Description

@wclr

Description

I have a foreing.js with the code:

exports.fn = (
  x, y
) => {

};

and the compiler while bundling turns it into doesn't respect existing formatting of brackets and arrows:

(function(exports) {
  exports.fn = (
    x, y)
    => {

  };
})(PS["BadForeign"] = PS["BadForeign"] || {});

putting ) not in the same line as the =>.

While this code is totally legal JS this just cased the problem for me while building with ncc: vercel/ncc#721

To Reproduce

Create a module with a foreign code above and bundle. (purs bundle ./output/BadForeign/*.js -o bad-bundle.js)

Expected behavior

Respect (at least not break in this strange way) the existing formatting of the foreign module code?

Additional context

PureScript version

0.14.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions