Skip to content

Postprocessing JS #18740

@jeswr

Description

@jeswr

The current JS that emscripten generates uses some old conventions + often generates unused code; I have seen a few issues going around offering manual updates of some of these things.

I wanted to note that a combination of tools like lebab, eslint and rollup could be used in a post processing step to tidy up the .js files that emscripten emits.

In particular, with the default eslint and rollup configs I just ran on a generated file called swipl.js

lebab --replace swipl.js --transform arrow,arrow-return,for-of,arg-rest,arg-spread,obj-method,obj-shorthand,no-strict,exponent,multi-var,let,class,commonjs,template,default-param,destruct-param,includes
eslint swipl.js
rollup swipl.js -o out.js

The out.js was about 10% smaller on the project I tried and has various code smells removed such as limiting the use of var, removing unused variables etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions