Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Webpack uses GAS keywords when compiling code #3

Open
p6l-richard opened this issue Feb 3, 2020 · 1 comment
Open

Webpack uses GAS keywords when compiling code #3

p6l-richard opened this issue Feb 3, 2020 · 1 comment

Comments

@p6l-richard
Copy link

Hey there,

thanks a lot for making this tutorial. Very helpful.

When I tried customizing your project I have noticed that some npm modules won't get compiled in a GAS friendly way.

Here's my setup:

  1. Cloned your repo & npm installed all dependencies
  2. In lib.js I have added:
[...]
import bizSdk from 'facebook-nodejs-business-sdk';


function getActId(){
	const accessToken = '<VALID_ACCESS_TOKEN';
	
	const FacebookAdsApi = bizSdk.FacebookAdsApi.init(accessToken);
	const AdAccount = bizSdk.AdAccount;
	
	const account = new AdAccount(`act_${<ACCOUNT_ID>}`);
	return account.id

}
[...]
export {
    getObjectValues,
    getTodaysDateLongForm,
    getDaysToAnotherDate,
	printSomeNumbers,
	getActId
}; 

I've tried calling the function in the api.js Logger.log(AppLib.getActId()) but am getting the following error:
SyntaxError: Missing name after . operator. (line 2385, file "lib.bundle")

I believe this might somehow be related to the other SyntaxError issue.

@Isaacwhyuenac
Copy link
Contributor

Isaacwhyuenac commented Jul 16, 2020

It seems like there is an error when webpack has compiled moment. Lodash does not have that kind of error.

I found that if you add

{
   "runtimeVersion": "V8"
}

in appsscript.json. This error would disappear.

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

No branches or pull requests

2 participants