ES Module Support
See original GitHub issueExpected Behavior
Note: This is still more of an idea than an actual issue. The design needs to be though out a bunch more.
You should be able to separate code with ES modules.
Use require
, import
, etc.
Actual Behavior
All variables/functions are globally scoped like the web.
Solution
Use a modern JavaScript bundler (webpack) under the hood. Make things “just work”.
This would allow for better library support in the future.
Caveats
- We may have to support only TS for module support initially.
- In Apps Script, all methods are exposed by default. We may have to manually expose some methods.
Links
Issue Analytics
- State:
- Created 5 years ago
- Reactions:19
- Comments:22 (6 by maintainers)
Top Results From Across the Web
JavaScript modules via script tag | Can I use... Support tables ...
Loading JavaScript module scripts (aka ES6 modules) using <script type="module"> Includes support for the nomodule attribute. Usage % of. all users, all tracked ......
Read more >JavaScript modules - MDN Web Docs
This guide gives you all you need to get started with JavaScript module syntax.
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Node.js fully supports ECMAScript modules as they are currently specified and provides ... Dynamic import() is supported in both CommonJS and ES modules....
Read more >Using ES Modules in the Browser Today - SitePoint
The Current ES Modules Landscape. Safari, Chrome, Firefox and Edge all support the ES6 Modules import syntax. Here's what they look like.
Read more >ES modules in service workers - web.dev
js. While all modern browsers offer some ES module support, they don't all offer support everywhere that code can be run. Specifically, support ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://developers.google.com/apps-script/guides/v8-runtime
This is a larger issue than clasp itself so I’m going to move this to the Nice To Have bucket. I think natively running Node would be better than bundling like this.