Skip to content

Export leaflet version as string replaced via rollup#9662

Closed
simon04 wants to merge 1 commit into
Leaflet:mainfrom
simon04:rollup-replace-version
Closed

Export leaflet version as string replaced via rollup#9662
simon04 wants to merge 1 commit into
Leaflet:mainfrom
simon04:rollup-replace-version

Conversation

@simon04

@simon04 simon04 commented Apr 20, 2025

Copy link
Copy Markdown
Contributor

Supersedes #9657.

@Falke-Design

Copy link
Copy Markdown
Member

With that change we could also remove the preprocessors for Firefox?

@simon04 simon04 force-pushed the rollup-replace-version branch from 847a92a to df22fe7 Compare April 20, 2025 13:50
@simon04

simon04 commented Apr 20, 2025

Copy link
Copy Markdown
Contributor Author

With that change we could also remove the preprocessors for Firefox?

Yeah. I've removed them.

@Falke-Design Falke-Design requested a review from jonkoops April 20, 2025 14:01
@Falke-Design

Falke-Design commented Apr 20, 2025

Copy link
Copy Markdown
Member

The down side of this approach is, that for the not bundled version, the version is always latest.
At the moment the version in package.json will be modified with a new release and is then exported for the unbundled version too.

@simon04

simon04 commented Apr 20, 2025

Copy link
Copy Markdown
Contributor Author

Yeah, true. I've amended this PR and search and replace version = 'latest' with version = 'x.y.z' if process.env.NODE_ENV === 'release'.

@Falke-Design

Copy link
Copy Markdown
Member

@simon04 did you push? I don't see any changes

@simon04 simon04 force-pushed the rollup-replace-version branch from df22fe7 to 0314f28 Compare April 20, 2025 14:39
@simon04

simon04 commented Apr 20, 2025

Copy link
Copy Markdown
Contributor Author

Err, not to this branch (was considering a separate branch for a moment). Pushed now.

@Falke-Design Falke-Design left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

waiting for a second approval

@Falke-Design Falke-Design added this to the 2.0 milestone Apr 20, 2025
@Falke-Design

Copy link
Copy Markdown
Member

Sorry for the ping @jonkoops @IvanSanchez @mourner - I’d like to proceed with version 2.

@IvanSanchez

Copy link
Copy Markdown
Member

@Falke-Design @simon04 Please remind me - what's the rationale for ditching the current rollup plugins approach? Compatibility issues with 2025 toolchains?

I'm kinda against using latest, as I'd prefer the git commit hash in that scenario.

@simon04

simon04 commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

Hi, see #9609 (comment). At the moment, the entire content of package.json ends up in the dist bundle.

@Falke-Design

Copy link
Copy Markdown
Member

@IvanSanchez the goal would be to be able to access the classes directly without the bundle.
With the current approach, loading the package.json and export version we add the whole package.json to the bundle: #9609 (comment)

@Falke-Design

Copy link
Copy Markdown
Member

I don't like "latest" that much either. We could always overwrite the version variable with the actual version and commit it

@IvanSanchez

Copy link
Copy Markdown
Member

I'd rather have something like __LEAFLET_VERSION__ as the placeholder string.

Also, can you folks try out if the namedExports option of the JSON rollup plugin ( https://github.com/rollup/plugins/tree/master/packages/json#namedexports ) would solve the "whole package.json in bundle" issue?

@simon04

simon04 commented May 6, 2025

Copy link
Copy Markdown
Contributor Author

The named export was in use prior to #9609. But browsers (running the non-bundled code while testing) do not support named imports, see #9609 (comment).

@Falke-Design

Copy link
Copy Markdown
Member

Thanks for the suggestion but I just merged #9717

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.

3 participants