Comments (3)
If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 so we can see what is popular when we triage.
@ABuffSeagull Thank you for opening this issue. 🙏
Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
- StackOverflow - use the
google-maps
tag
This is an automated message, feel free to ignore.
from google-maps-services-js.
Hey @ABuffSeagull,
this module is very likely free of sideEffects per the webpack definition:
A "side effect" is defined as code that performs a special behavior when imported, other than exposing one or more exports. An example of this are polyfills, which affect the global scope and usually do not provide an export.)
However, I'd like to point out two things:
- this package is only meant to be used in server side applications. Although it might work in certain situations, bundling it into a client-application is not officially supported or recommended. What you are seeing (importing a massive polyfill for the crypto-library) is part of the reason why.
- from the screenshot you shared, it looks like you are using the places autocomplete service. This service (as all others) requires the serializer, which in turn needs the url-signing functions which uses crypto-functions to compute a checksum for urls in certain cases. None of that would be going away by marking the package sideEffect free.
The recommended way to use the autocomplete API in a regular client-application is either using the Maps JavaScript API or directly via fetch.
Depending on your use-case, something as simple as
async function queryAutocomplete(input) {
const url = new URL('https://maps.googleapis.com/maps/api/place/queryautocomplete/json');
url.searchParams.set('input', input);
url.searchParams.set('apiKey', YOUR_API_KEY);
const res = await fetch(url.toString());
const data = await res.json();
return data.predictions;
}
could already be enough.
from google-maps-services-js.
Hey, thanks for the response!
In my use case, I'm using Remix which colocates both server and client code in the same file, and relies on tree-shaking in order to remove the server-side code from the client-side bundle.
Without the "sideEffects": false
property, the compiler does not know whether it is allowed to remove this package from the client side bundle, leading to the situation shown in the original post. You can see more info here.
from google-maps-services-js.
Related Issues (20)
- Address autocomplete ApiNotActivatedMapError HOT 1
- StreetViewService.getPanorama implementation HOT 2
- Cross-site Request Forgery (CSRF) issue with Axios, replace with fetch? HOT 7
- Add new Pollen APIs HOT 1
- Google RouteMatrix needed. HOT 2
- Dependency url-signature using a version of crypto-js with critical vulnerability HOT 6
- New APIs: Address Validation, Datasets, Places, Routes HOT 4
- Autocomplete prediction type fields should be optional HOT 1
- Rename primary branch to main
- reviews_sort & reviews_no_translations fields are not included in place deatils params HOT 2
- "Place Details (New)" API calls HOT 4
- Directions: Missing type "google.maps.DirectionsStatus" in "google.maps.DirectionsResult" OS:W11 Pro HOT 1
- Cannot find module 'core-js/modules/es.string.replace.js' HOT 5
- Add support for Address Descriptors to Geocoding
- Cross-Origin-Resource-Policy missing from response header of khms0.googleapis.com and khms1.googleapis.com HOT 1
- Error: Cannot find module 'core-js/modules/es.string.replace.js' HOT 10
- Places.placeAutocomplete can't filter by country HOT 1
- 127.0.0.1:22259/main/0/storage/emulated/11/Download/Takeout/Historial de ubicaciones (Rutas)/Timeline Edits.GeoJSON.gpx.html
- Error: Type '"origin" | undefined' is not assignable to type '"origin"' during Build. HOT 7
- TypeScript error in Request interfaces HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-maps-services-js.