diff --git a/hugo/src/js/quicklink.js b/hugo/src/js/quicklink.js index a04a35b7..5c943dbb 100644 --- a/hugo/src/js/quicklink.js +++ b/hugo/src/js/quicklink.js @@ -1,20 +1,10 @@ -import { prefetch } from 'quicklink/dist/quicklink.mjs'; +import { listen } from 'quicklink'; -function start(options = {}) { - prefetch({ +window.addEventListener('load', () => { + listen({ ignores: [ (_, elem) => String(elem.getAttribute('href'))[0] === '#', (_, elem) => elem.matches('[noprefetch]') || elem.closest('[noprefetch]'), ], - ...options, }); -} - -document.addEventListener('turbolinks:load', start); -document.addEventListener('quicklink', (e) => start(e.detail || {})); - -if (document.readyState === 'loading') { - document.addEventListener('DOMContentLoaded', start); -} else { - start(); -} +}); diff --git a/hugo/webpack.mix.js b/hugo/webpack.mix.js index 07d4e7a5..4f06eb8f 100644 --- a/hugo/webpack.mix.js +++ b/hugo/webpack.mix.js @@ -142,7 +142,4 @@ mix.webpackConfig({ output: { publicPath: '/build', }, - optimization: { - splitChunks: 'all', - }, }) \ No newline at end of file