Skip to content

Instantly share code, notes, and snippets.

@vamsiampolu
Last active March 29, 2017 14:58
Show Gist options
  • Save vamsiampolu/48d1baee159bb9b8ff46cdf03d5f8635 to your computer and use it in GitHub Desktop.
Save vamsiampolu/48d1baee159bb9b8ff46cdf03d5f8635 to your computer and use it in GitHub Desktop.
Webpack Google APIs with scriptjs
require('expose?gapiCallback!./google-client-code');
require('expose?gmapsCallback!./google-maps-code');
$script('https://maps.googleapis.com/maps/api/js?onload=window.gapiCallback','google-maps');
$script('https://apis.google.com/js/client.js?callback=window.gmapsCallback','google-api');
const googleClient = () => {
console.log(gapi);
};
export default googleClient;
const mapsCallback = () => {
console.log(google);
};
export default mapsCallback;
@jonathanmv
Copy link

Hi, thanks for sharing this. Would you mind also sharing the webpack config to see how to configure the loader please?

@jonathanmv
Copy link

I posted a comment on your medium article. What I see is that the webpack loader is not needed.
Here's the link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment