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

fix(core): remove pure markers from js module output #2936

Merged
merged 4 commits into from
Jan 14, 2024
Merged

Conversation

idoros
Copy link
Collaborator

@idoros idoros commented Jan 12, 2024

This PR removed the /#PURE/ annotations from the JavaScript module output. The reason for this removal is that these markers appear to trigger errors with vite@5:

A comment "/* #PURE*/" in "..." contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues

Although we currently do not conduct tests on vite (at all), this pull request introduces new tests. These tests are designed to verify the effectiveness of tree-shaking for different build tools, including webpack, rollup, and esbuild. The goal is to ensure that the removal of these markers does not adversely impact the final output.

The annotations have been completely removed as it appears they no longer influence tree-shaking. This could be due to improvements in the tree-shaking algorithm over time or because the module output has been simplified to the extent that these annotations are now redundant.


Note: this should be merged to stylable@5 first and then cherry-picked to master

@idoros idoros added core Processing and transforming logic integration Bundler, test-runner and node 5.x Stylable v5 related labels Jan 12, 2024
@idoros idoros requested a review from barak007 January 12, 2024 12:03
@idoros idoros self-assigned this Jan 12, 2024
@idoros idoros merged commit 0ff9c3f into 5.x Jan 14, 2024
12 checks passed
@idoros idoros deleted the ido/fix-pure-markers branch January 14, 2024 07:50
idoros added a commit that referenced this pull request Feb 1, 2024
* test(webpack): check js module tree-shake
* test(rollup): check js module tree-shake
* test(esbuild): check js module tree-shake
* chore: remove unneeded pure functions markers from generated js module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.x Stylable v5 related core Processing and transforming logic integration Bundler, test-runner and node
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants