mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 11:35:28 +00:00
fix navigation and ESM stuff
This commit is contained in:
@@ -8,7 +8,7 @@ const create_app = require('./utils/create_app.js');
|
||||
const create_webpack_compiler = require('./utils/create_webpack_compiler.js');
|
||||
|
||||
const esmRequire = esm(module, {
|
||||
esm: 'all'
|
||||
esm: 'js'
|
||||
});
|
||||
|
||||
module.exports = function connect(opts) {
|
||||
|
||||
@@ -3,7 +3,14 @@ window.addEventListener('click', event => {
|
||||
while (a && a.nodeName !== 'A') a = a.parentNode;
|
||||
if (!a) return;
|
||||
|
||||
if (navigate(new URL(a.href))) event.preventDefault();
|
||||
if (navigate(new URL(a.href))) {
|
||||
event.preventDefault();
|
||||
history.pushState({}, '', a.href);
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener('popstate', event => {
|
||||
navigate(window.location);
|
||||
});
|
||||
|
||||
const target = document.querySelector('main');
|
||||
|
||||
@@ -30,7 +30,7 @@ module.exports = function create_app(routes, dest, matchers, dev) {
|
||||
}
|
||||
`.replace(/^\t{3}/gm, '').trim();
|
||||
})
|
||||
.join(' else ');
|
||||
.join(' else ') + ' else return false;';
|
||||
|
||||
const main = template.replace('// ROUTES', code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user