Skip to content

Commit

Permalink
fix(build): underscored files weren't ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Apr 18, 2020
1 parent f4cac8d commit c160759
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/middleware/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,15 @@ const defineFiles = createNodeMiddleware(({ file }) => {
})


const removeNonSvelteFiles = createNodeMiddleware(({ file }) => {
const removeNonSvelteFiles = createNodeMiddleware(({ file, parent }) => {
const isUnderscored = file.name.match(/^_/)
const isPage = !file.badExt && !isUnderscored
const isNormalDir = file.children && !isUnderscored
return isPage || isNormalDir || file.isLayout || file.isFallback
const keep = isPage || isNormalDir || file.isLayout || file.isFallback
if(!keep){
const index = parent.children.indexOf(file)
parent.children.splice(index, 1)
}
})


Expand Down

0 comments on commit c160759

Please sign in to comment.