Skip to content

Document a How To on using Svelte with Babel #3388

@arggh

Description

@arggh

Is your feature request related to a problem? Please describe.

It's a common request to be able to serve a website to users with older browsers, like IE11 or iOS Safari 9.

This requires all sorts of polyfilling & transpilation happening behind the scenes.

However, there's a few gotchas in getting Babel, the de facto tool for transpiling modern code into digestable ES5, to work together with Rollup/Webpack and Svelte. Would be nice, if there was a well documented, visibly linked and thoroughly explained starting point to fork from. Or at least something to copy-paste from.

For example, this golden nugget of information was hidden in a comment inside a closed issue:

Also notice that at least for rollup-plugin-babel, you will have to explicitly configure it to handle Svelte's components as they are recognized from their original extension. So add something like extensions: ['.js', '.html', '.svelte'] when enabling Babel.

Trying to search the Svelte website for "Babel" gets exactly 0 results. Which is stupid.

Describe the solution you'd like
I'd like a clear how-to on the Svelte website with copy-paste config examples on getting Babel to run with Svelte, so people could spend their time doing actual work or being outdoors ☀️

How important is this feature to you?
It's not very important to myself anymore, as I already sacrificed a fair amount of my own time to fiddle together a working setup. However, I believe it is useful for the general public, and very easy to implement.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions