svelte-ie-webpack-example
Webpack config example of polyfill and transpile needed for svelte to support IE 11
polyfill:
- core-js
- regenerator-runtime
- custom element polyfill, for example: @webcomponents/custom-elements
transpile
- setup babel and babel-loader (webpack)
- setup babel-loader to exclude node_module but include svelte
- if you're using windows, the regex of path needed to be windows-style(
\
). - The
test
property of babel-loader must be changed to include.mjs
(/\.m?js$/
) because svelte's runtime use.mjs
extension. - don't transpile
core-js
. if you transpile it, polyfill won't work.
- if you're using windows, the regex of path needed to be windows-style(
- setup babel-loader to transpile svelte file. Noted in the
use
propertysvelte-loader
must be afterbabel-loader
, so thatsvelte-loader
would execute first.