Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aller/svelte-components

Package Overview
Dependencies
Maintainers
15
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aller/svelte-components

We need a project that can host our svelte components. We would like to server side render the components, and this is mostly just testing what the best approach to doing that would be

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
decreased by-95.91%
Maintainers
15
Weekly downloads
 
Created
Source

We need a project that can host our svelte components. We would like to server side render the components, and this is mostly just testing what the best approach to doing that would be

Run
  1. yarn
  2. yarn dev
  3. localhost:3000/render/example
Overview

So far this works by making webpack create three different bundles. One for the server, one for modern browsers and one for legacy browsers.

  • The server bundle is used to server side render the svelte component. The bundle is created by targeting the main .svelte file directly
  • The modern and legacy bundle are used clientside. These bundles are created by targeting each components main .js file. The legacy bundle is transpiled and polyfilled to support IE11

The server will respond with styled markup and a script tag that will download the bundle. Once the bundle is downloaded, the component will hydrate and become interactive

Structure

As a result of the pattern above, each svelte components needs to be placed within it's own folder in /src. The components folder should contain a .svelte and .js file with the same name as the component folder. The .js file's target also needs to inlude the name of the component target: document.getElementById("svelte-app-NAME_OF_COMPONENT"). Copy /src/example for a starting point

IE11 Support

We create two differende bundles for the client because we would like to avoid serving a heavily transpiled and polyfilled bundle to browser's that does not need it. We include the modern bundle with a script type="module" tag and the legacy bundle with a script nomodule tag. Modern browsers that support ES2015+ will download the modern bundle and ignore the legacy bundle. Legacy browsers that does not support type="module" will download and execute the legacy bundle. Some might download the modern bundle as well, but not execute it. More information about this approach

FAQs

Package last updated on 30 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc