Using transpiled ES6 in Google Apps Script => ReferenceError: “SomeClass” is not defined

前端 未结 5 1376
生来不讨喜
生来不讨喜 2020-12-17 00:29

I\'m trying to use ES6 in a Google Spreadsheet (in the script.google.com part). I\'m pretty new to JavaScript and maybe the error is trivial ...


5条回答
  •  余生分开走
    2020-12-17 01:04

    I tried several of the suggested ways mentioned above. However, utilizing this plugin with webpack 2.X is the only thing that worked for me.

    https://github.com/fossamagna/gas-webpack-plugin

    Please Note: This does not yet work with webpack 4.X.

    I could regurgitate their Readme.md here, but I find that unnecessary.

    In a nutshell you need to add this plugin to your webpack config and then add functions to global. These functions get added as top level functions.

提交回复
热议问题