Skip to content

Commit

Permalink
✨ improve(patch): prevent duplicate entrypoint imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kellymears committed Sep 19, 2023
1 parent b2ccc34 commit 7e1d273
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sources/@roots/bud-build/src/config/entry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import type {Factory} from '@roots/bud-build/config'

export const entry: Factory<`entry`> = async ({hooks}) =>
hooks.filter(`build.entry`, {main: {import: [`index`]}})
export const entry: Factory<`entry`> = async ({hooks}) => {
const entrypoints = hooks.filter(`build.entry`, {main: {import: [`index`]}})

return Object.entries(entrypoints).reduce((acc, [key, value]) => {
value.import = [...new Set(value.import)]
return {...acc, [key]: value}
}, {})
}

0 comments on commit 7e1d273

Please sign in to comment.