Giter Club home page Giter Club logo

sapper-ie's Introduction

Sapper IE

IE and Windows Edge barely qualify as browsers, but they are able to render HTML/CSS and execute JS, in a form. These modifications to the language help incapable browsers render websites.

Status:

It Works!

  • IE11 - Fully working
  • Edge - Fully working

Changes from default Sapper

  1. Polyfils in template.html (via Polyfill.io):
  • default
  • fetch
  • Array.prototype.find
  • Object.values (not strictly necessary - but useful)
  1. Non-legacy (regular build) has rest spread so that Edge works (wow)
!legacy && babel({
    extensions: ['.js', '.mjs', '.html', '.svelte'],
    exclude: ['node_modules/@babel/**'],
    plugins: [
      '@babel/plugin-syntax-dynamic-import',
      '@babel/plugin-proposal-object-rest-spread'
    ]
  }),
  1. Special run mode to run the app via bable for easy local testing
npm run build:dev

Running

Don't expect this to work in IE/Edge in dev mode.

npm run build # has shimport hack for easier debugging
node __sapper__/build

sapper-ie's People

Contributors

antony avatar benmccann avatar benwinding avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sapper-ie's Issues

Strange White Box Overlay in ie11

There's a small problem I'm getting in IE11 (11.0.9600.18762) anyone else getting this, or have any idea what this is?

image

Cheers,
Ben

Align transpiling with babel & core-js future

First of let me say this is amazing work and saved me lots of hassle getting IE11 support to work.

After tinkering with the Rollup configuration I think it would be possible to simplify some stuff and make the transpiling-step a bit more efficient.

A few months ago I stumbled upon this doc in the core-js repo which outlines some of the work done on integrations between core-js and babel. Here the core-js contributors explain how the @babel/polyfill and @babel/runtime packages will be deprecated in favour of handling polyfills and ES-proposals with the @babel/preset-env and @babel/plugin-transform-runtime with @babel/runtime-corejs3 packages. In some other projects I've successfully changed setups from using the (old) polyfills to core-js and I believe I've got it working for svelte as well.

I noticed that in the current rollup setup the babel plugin is instantiated twice. I believe this could work with one passโ€”with a core-js integrated setup.

I've installed the following packages and versions:

...
"@babel/core": "^7.4.5",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/runtime-corejs3": "^7.4.5",
"core-js": "^3.1.4",
...

And replaced lines 35-60 in the rollup-config.

...
legacy && babel({
  extensions: [".js", ".mjs", ".html", ".svelte"],
  runtimeHelpers: true,
  exclude: [
    "node_modules/@babel/**",
    "node_modules/core-js/**",
    "node_modules/core-js-pure/**"
  ],
  presets: [
    [
      "@babel/preset-env",
      {
        corejs: 3,
        useBuiltIns: "usage",
        targets: "> 0.25%, ie >= 11, not dead"
      }
    ]
  ],
  plugins: [
    "@babel/plugin-syntax-dynamic-import",
    [
      "@babel/plugin-transform-runtime",
      {
        corejs: 3,
        useESModules: true
      }
    ]
  ]
}),
...

As you can see the @babel/plugin-proposal-object-rest-spread is no longer needed. And after some testing it does not appear to negatively impact the builds. If you want I could fix up a pull-request for these changes somewhere in the coming days.

SVGElement hydration issue when using `@html` directive and IE11

I'm not sure if this is the appropriate place to file this issue, but since this repo's focus is on IE/Edge Legacy support, I thought I would start here.

The Problem

I came across a hydration bug within Svelte that relates to the @html directive and IE11's lack of support for SVGElement.prototype.innerHTML. As you can see in the example below, the icon is displayed before hydration and then disappears.

Example

<script>
  const iconData = `<line x1="12" y1="18" x2="12" y2="12"></line><line x1="9" y1="15" x2="15" y2="15"></line>`;
</script>
<div>Can you see the plus svg icon right below disappear upon hydration? ๐Ÿ‘‡</div>
<svg>{@html iconData}</svg>

results in something similar to:
icon-flash

Proposed Solution

Add a polyfill

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.