Svelte Ie11 screenshot

Svelte Ie11

Author Avatar Theme by Garytube
Updated: 19 Nov 2021
16 Stars

Svelte with IE11 Support & fetch pollyfill - For all of us who needs to support older Hardware

Overview

This product analysis will focus on the Svelte JS Rollup Config for IE11 Support. The rollup config is designed to enable support for Internet Explorer 11 (IE11) in Svelte JS applications.

Features

  • IE11 Support: The rollup config enables IE11 support in Svelte JS applications, allowing them to run smoothly on this legacy browser.
  • Rollup-plugin-babel: This config utilizes the rollup-plugin-babel to transpile modern JavaScript syntax, making it compatible with older browsers like IE11.
  • Async/Await Support: Additionally, the rollup config enables support for async/await syntax, providing compatibility with applications that rely on this modern JavaScript feature.

Installation

To install the Svelte JS Rollup Config for IE11 Support, you need to follow these steps:

  1. Open your command line interface.
  2. Navigate to the root directory of your Svelte JS application.
  3. Install the rollup-plugin-babel package by running the following command:
npm install rollup-plugin-babel --save-dev
  1. Configure your Rollup configuration file (rollup.config.js) to enable IE11 support and async/await syntax. Here is an example configuration using the rollup-plugin-babel:
import babel from 'rollup-plugin-babel';

export default {
  // ... rest of your Rollup config ...

  plugins: [
    // ... other plugins ...
    babel({
      exclude: 'node_modules/**',
      presets: [
        [
          '@babel/preset-env',
          {
            targets: {
              ie: '11',
            },
          },
        ],
      ],
      plugins: [
        '@babel/plugin-transform-runtime',
      ],
    }),
  ],
};
  1. Save the changes to your rollup.config.js file.

Summary

The Svelte JS Rollup Config for IE11 Support is a useful tool for developers who need to ensure their Svelte JS applications can run on legacy browsers like IE11. By enabling IE11 support and transpiling modern JavaScript syntax using rollup-plugin-babel, the rollup config ensures compatibility with older browsers while also supporting async/await syntax.