Skip to content

Instantly share code, notes, and snippets.

@JustinBeckwith
Created February 2, 2018 19:49
Show Gist options
  • Save JustinBeckwith/c48bc7aeb4c0d751688470555d6f6ce3 to your computer and use it in GitHub Desktop.
Save JustinBeckwith/c48bc7aeb4c0d751688470555d6f6ce3 to your computer and use it in GitHub Desktop.
Webpack bug
<html>
<head>
<title>Getting Started</title>
</head>
<body>
<script src="bundle.js"></script>
</body>
</html>
{
"name": "gal-web",
"version": "1.0.0",
"scripts": {
"webpack": "webpack"
},
"license": "ISC",
"devDependencies": {
"webpack": "^3.10.0"
},
"dependencies": {
"google-auth-library": "^1.2.1"
}
}
import {OAuth2Client} from 'google-auth-library';
function doAuth() {
const client_id = "some-key";
const url = 'https://www.googleapis.com/plus/v1/people?query=pizza';
return oAuth2Client.request({ url }).then(res => {
console.log(res.data);
const client = new OAuth2Client({client_id});
const authorizeUrl = oAuth2Client.generateAuthUrl({
access_type: 'offline',
scope: 'https://www.googleapis.com/auth/plus.me'
});
window.open(authorizeUrl);
}).catch(e => {
console.error(':(');
console.error(e);
});
}
doAuth();
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
node: {
fs: 'empty',
child_process: 'empty'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment