juliangruber / browser-run

Run code inside a browser from the command line
447 stars 62 forks source link

Support import in scripts #155

Open dy opened 4 years ago

dy commented 4 years ago

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

juliangruber commented 4 years ago

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?

dy commented 4 years ago

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 notifications@github.com 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 .