question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ES Module Support

See original GitHub issue

Expected 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:closed
  • Created 5 years ago
  • Reactions:19
  • Comments:22 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
grantcommented, Oct 29, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found