Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent incorrect PURE annotations being added to built index.js file #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timdown
Copy link
Contributor

@timdown timdown commented Jul 12, 2022

The built dist/index.js contains /*@__PURE__*/ annotations, as mentioned in the CM buildhelper README:

NOTE: This tool will add a /*@__PURE__*/ annotation in front of every top-level function call, to allow tree-shaking of things like Facet.define(...). This is likely to break some styles of code (which, say, uses a side-effecting helper function to build up some top-level data structure), but I wasn't able to find another approach for working with the crude current state of JS dead-code detection tools.

In particular, dist/index.js contains the following lines:

for (let i in emacsKeys) {
    /*@__PURE__*/EmacsHandler.bindKey(i, emacsKeys[i]);
}

When fed through Terser (as webpack does, for example), the bindKey() call is removed and none of the key bindings work.

This PR changes the build to use Marijn's buildtool, which has an option to omit the /*@__PURE__*/ annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant