# Mock it away!
jest.mock('svelte-navigator', () => ({useResolve: () => (jest.fn()), link: jest.fn()}));
(Example for ROLLUP)
(add before the bundle.js)
<script defer src="https://polyfill.io/v3/polyfill.min.js"></script>
npm install -D @babel/plugin-syntax-dynamic-import @babel/plugin-transform-runtime @babel/runtime @rollup/plugin-babel corejs whatwg-fetch
import babel from '@rollup/plugin-babel';
...
...
!production && livereload('public'),
// IE11 support 😬 😥
babel({
babelHelpers: 'runtime',
extensions: ['.js', '.mjs', '.html', '.svelte'],
exclude: ['node_modules/@babel/**', 'node_modules/core-js/**'],
presets: [['@babel/preset-env', {targets: {ie: '11'}, useBuiltIns: 'usage', corejs: 3}]],
plugins: ['@babel/plugin-syntax-dynamic-import', ['@babel/plugin-transform-runtime', {useESModules: true}]]
}),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
...
...
Using fetch
? For each file that you're using fetch, add this to the top:
import 'whatwg-fetch';
Using typescript? Might need to use a ts preset for babel!
"@babel/preset-typescript"