browser-run icon indicating copy to clipboard operation
browser-run copied to clipboard

Support import in scripts

Open dy opened this issue 5 years ago • 2 comments

Trying to come up with node ES module, working both in browser/node. It uses import. cat test.js | browser-run gives

SyntaxError: Unexpected identifier
  at http://localhost:55133/bundle.js:1:8 

Would that be reasonable to detect if input code uses import (see is-module) and include script as <script type="module"></script>?

dy avatar Jun 18 '20 22:06 dy

We could try that, but I'd rather add a flag instead of detecting the module type, for now at least. Would you be interested in working on a PR for this?

juliangruber avatar Jul 01 '20 10:07 juliangruber

I would, but I have limitation contributing to open-source now, it’s going to take some time (mb a couple of weeks or more)

On Wed, Jul 1, 2020 at 7:00 AM Julian Gruber [email protected] wrote:

We could try that, but I'd rather add a flag instead of detecting the module type, for now at least. Would you be interested in working on a PR for this?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/juliangruber/browser-run/issues/155#issuecomment-652350889, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACJII7IZEMORBVA3NGZUQLRZMJLVANCNFSM4OCF5P6Q .

dy avatar Jul 01 '20 21:07 dy