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.

Implement minimal effort compromise to support Deno/ ESM

See original GitHub issue

Is your feature request related to a problem? Please describe. Deno is slowly gaining traction and we see some requests to support svelte development from deno. However it was decided that maintaining a “native” ESM release next to the nodejs one would be too much work for the svelte team in the current setup.

Describe the solution you’d like I propose a minimal effort compromise to allow supporting ESM/ deno based workflows by officially referring to available bridge software (snowpack and/or unpkg.com) and just maintaining the minimally needed changes in the svelte codebase that are necessary to run in such a setup without manual patching.

Describe alternatives you’ve considered #4807: "[…] removing the snowpack [eg. be available for deno in the pika registry] requirement would be more work to get right […] It would require either package.json to support multiple module entry points, which it currently does not, or for us to find a way to export the compiler into the main module entry point without making esm importing browsers to import the compiler when not needing it. […]

How important is this feature to you? It would be most important to new developers that try out svelte + deno and all run into the same issues. If we minimally support this and also add a few sentences of documentation we could save each of these developers work and possibly duplicate issues or support requests on discord.

Implementation Details There are currently two possibilities to do this

a) by using snowpack

  • add a compiler option to include a “.js” or “.mjs” file ending so the import in the esm compiled output will be ..} from "svelte/internal.(m)js"; (as the probing for file extensions and handling of index.js files is nodejs specific) this could also be solved in a preprocessor step, but i think it is better to officially add the file ending when using the compiler with esm output
  • add a section to the svelte readme or the api docs or to the https://github.com/sveltejs/integrations repo how to use svelte with snowpack and deno, i would also create an example starter template and add my example deno/svelte build script

b) by using unpkg.com this method is also compatible with a, the only downside is that it requires one more change to the svelte codebase compared to a) This additional change already has a PR here: https://github.com/sveltejs/svelte/pull/4972

  • changes from a
  • add the compiler esm output to the nodejs package
  • add documentation in the appropriate place how to use unpkg.com to import the esm compiler

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:35
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

23reactions
Pierstovalcommented, Aug 18, 2020

Now that #4972 is merged, Svelte can be imported as ESM module, so we could use it as-is and start boostraping a Svelte project with deno 👍

21reactions
softgrippercommented, Sep 24, 2020

I’m looking forward to this.

Native typescript in deno is a godsend, and if I can easily get svelte running in the mix that would be great.

Right now, package.json and the tsc stuff is really annoying - requiring error prone bootstrap files… If deno and svelte just worked out of the box, I’d be very happy 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

esm@v99 - Deno
ESM. A fast, global content delivery network for NPM packages with ES Module ... You may also use a semver or a dist-tag...
Read more >
Deno 1.28: Featuring 1.3M New Modules - Hacker News
And this is a great move, help people to switch from "node" to "deno" while they keep using existing tools/libraries they use.
Read more >
Node.js rival Deno adds stable npm compatibility in effort to ...
The Deno team has released version 1.28 which “stabilizes npm compatibility,” according to a post today. This is a key feature since the...
Read more >
5 Deno Runtime Projects You Should Try - Fusebit
js and help you build robust Deno applications. In this article, you'll learn about five Deno runtime projects and look specifically at their ......
Read more >
An Introduction to Deno: Is It Better than Node.js?
Deno is a JavaScript and TypeScript runtime similar to Node.js, built on Rust ... and options provided by the Deno CLI, use the...
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