-
Notifications
You must be signed in to change notification settings - Fork 192
Closed
Description
When installing additional npm packages, some of them get transpiled using .default
to access an object. However, in GAS default
is a reserved keyword resulting in an error.
Expected Behavior
Webpack should use Babel to transpile Object property accessing using the bracket notation instead of the dot notation.
Current Behavior
clasp push
throws error
{
errors: [
{
message: 'Syntax error: Missing name after . operator. line: XXX file: bundle.js',
domain: 'global',
reason: 'badRequest'
}
]
}
bundle.js:
//...
Object.defineProperty(exports, "DataFrame", {
enumerable: true,
get: function get() {
return _dataframe.default;
}
});
//...
index.js:
import DataFrame from 'dataframe-js';
//...
const response = () => {
return JSON.parse(UrlFetchApp.fetch(url, { method: 'get' }));
}
DataFrame.fromJSON(response()).then(df => {
Logger.log(df);
});
Possible Solution
Beginner friendly explanation for installing additional packages that might conflict with the default
keyword or include babel-preset-gas in your project setup.
Steps to Reproduce
- clone
apps-script-starter
- cd to project,
npm install dataframe-js
- use
dataframe-js
functionality npm run deploy
Context (Environment)
I am a beginner wanting to set up an environment to develop in GAS using JavaScript. Since I'm handling data from APIs to be pushed to a Google Sheet, I would like to work with data frames to make data handling easier.
Metadata
Metadata
Assignees
Labels
No labels