-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Implement minimal effort compromise to support Deno/ ESM #5003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@lucidNTR with regards to |
@antony cool, did not know that repo.
|
@lucidNTR here are some other tickets where people are looking at Snowpack support in case it's helpful to you to find more collaborators on this: #4898 sveltejs/sapper#1204 |
@benmccann good point, thanks! i should clarify that i am not talking about general snowpack support for sapper/svelte, where snowpack acts as a rollup wrapper to do bundling and provide a dev server. This ticket here is only about the very small scope to use the "snowpack install" command to provide a deno compatible entry point. The actual implementation work required here is by design very minimal and i am happy to do it... |
The actual work is mostly to be able to use a proper "bundler" with Deno. There is already the Looking at making Rollup compatible with Deno sounds like a first-class issue to me (since Rollup seems the default proposed solution to bundle a Svelte/Sapper app). |
Can there be a way to use a custom bundler for this? It would be great if people could use esbuild. |
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 👍 |
Can you please upload a mock-up of how it would be achieved. I hardly understand how sveltes build system works with Node and Rollup |
I first need to find time to work on that 😉 |
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 👍 |
Is this not yet fully working? I haven't tried it yet, but I don't see a confirmation of it working at all so far. |
A while back there was a PR #5605 you may have hints over there, Good luck. |
Anyone else else looking for this solution, it's being built here: |
@DougAnderson444 Hi sorry for the late reply, i can confirm that in Deno imports without any errors and is able to compile all the svelte files i tried! I am still testing the resolution sub imports especially the missing file ending issue in the ticket |
@lucidNTR I've been working on a small project(snel) for a while to compile svelte projects with deno, I was able to make the compiler work 100% in deno, the only problem I have now is the way I solve the imports of linked components, for now if you can use well. btw any contribution to the project is very helpful. |
@buttercubz This is really interesting! Thanks for the link :) |
#4972 was merged and there's an As far as docs go, I'd suggest adding to https://github.com/sveltejs/integrations or https://sveltesociety.dev/. We try to document just the core API on svelte.dev since that's what the maintainers know and can reasonably be responsible for and prefer that the community handles all the other various platforms out there. Is there anything left to do here or should we close this ticket? |
i think can be closed, |
@buttercubz: I searched the www for this :) Is there a state of the art best practice recommendation from snel side available? This would solve crewdevio/Snel#40 ... |
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
..} 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
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:
#4972
The text was updated successfully, but these errors were encountered: