mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-18 05:25:08 +00:00
always create valid route id
This commit is contained in:
@@ -8,7 +8,7 @@ module.exports = function create_matchers(files) {
|
|||||||
const parts = file.replace(/\.(html|js|mjs)$/, '').split(path.sep);
|
const parts = file.replace(/\.(html|js|mjs)$/, '').split(path.sep);
|
||||||
if (parts[parts.length - 1] === 'index') parts.pop();
|
if (parts[parts.length - 1] === 'index') parts.pop();
|
||||||
|
|
||||||
const id = parts.join('_').replace(/[[\]]/g, '$');
|
const id = parts.join('_').replace(/[[\]]/g, '$') || '_';
|
||||||
|
|
||||||
const dynamic = parts
|
const dynamic = parts
|
||||||
.filter(part => part[0] === '[')
|
.filter(part => part[0] === '[')
|
||||||
|
|||||||
Reference in New Issue
Block a user