Skip to content
New issue

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

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

Already on GitHub? # to your account

[Map] Fix Google/Leaflet bridges when using Webpack Encore #2199

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

Kocal
Copy link
Collaborator

@Kocal Kocal commented Sep 23, 2024

Q A
Bug fix? yes
New feature? no
Issues Fix #2105
License MIT

This PR fixes #2105, and ensures Leaflet and GoogleMaps bridges are working fine with Webpack Encore.

To be sure:

  1. I've created a new Symfony app (no --webapp),
  2. Installed Encore, Stimulus, and Map
  3. Added .addAliases({ 'leaflet/dist/leaflet.min.css': 'leaflet/dist/leaflet.css' }) and .enableStimulusBridge('./assets/controllers.json') in webpack.config.js
  4. Created the Map (new Map()) and rendered it (ux_map(map, { style: 'height: ...' }))

I am able to display a Leaflet map:
image

And a GoogleMap maps:
image


The Map rendered on ux.symfony.com is also working (after updating the importmap.php as documented):

image

@carsonbot carsonbot added Bug Bug Fix Map Status: Needs Review Needs to be reviewed labels Sep 23, 2024
@@ -1,8 +1,48 @@
import AbstractMapController from '@symfony/ux-map/abstract-map-controller';
import { Controller } from '@hotwired/stimulus';
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Surely because Rollup has been able to resolve the file when using import AbstractMapController from '@symfony/ux-map', the AbstractMapController is now inlined.

I'm fine with this, especially it removes one useless HTTP request.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great!

Copy link
Collaborator

@smnandre smnandre left a comment

Choose a reason for hiding this comment

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

Nice!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Sep 23, 2024
@Kocal Kocal merged commit 48c5fa1 into symfony:2.x Sep 24, 2024
59 checks passed
@Kocal Kocal deleted the fix-map-bridges-webpack branch September 24, 2024 06:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug Bug Fix Map Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Leaflet] Error during installation
4 participants