Skip to content
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

[Help Wanted] Simplifying the Rollup Config #3

Closed
nickreese opened this issue Aug 10, 2020 · 1 comment
Closed

[Help Wanted] Simplifying the Rollup Config #3

nickreese opened this issue Aug 10, 2020 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@nickreese
Copy link
Contributor

Currently, one of the biggest drawbacks to Elder.js is the overly complex rollup config.

At the core we've got 2 issues.

  1. We need to make sure that all components that will be SSR'd have a precompiled template generated.
  2. We need to make sure all templates that will be mounted will have a bundled version we can use to hydrate the client.

This weekend I spent some time studying Svelte's register.js function in an attempt to get on the fly compiling of SSR svelte components.

The biggest roadblock I hit was with packages that use ESM syntax.

Honestly, I don't know anything about ESM or CJS or anything around the debate. It has been something I've buried my head in the sand about for the past 2 years. That said, I think someone more experience could help simplify the rollup process and possibly help us compile SSR components on the fly.

It appears that we could use Rollup from within node, but this is something I haven't had a chance to test yet.

@nickreese nickreese added the help wanted Extra attention is needed label Aug 10, 2020
@nickreese
Copy link
Contributor Author

So I've continued investigating this and beyond doing anything trivial we'll need to use Rollup bundle the SSR components because of ESM imports.

https://github.com/nickreese/ssr-svelte-playground

All this said, upon further exploration I think we could use systemjs as a fallback and esm as the default by adapting some of the patterns seen in this repo: https://github.com/rollup/rollup-starter-code-splitting. This would give us robust browser support allowing new browsers to use ESM and older browsers to use systemjs.

It just adds more complexity to the rollup file though. 👎

On the plus side we may be able to only bundle the SSR components, then use something like nollup/vite/snowpack for development. Still more exploring to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant