Skip to content

Commit

Permalink
fix: add optimize shiki in case of pnpm shamefully hoist
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Oct 14, 2022
1 parent 149a557 commit a1014ab
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/histoire/src/node/vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { parseColor } from './colors.js'
import { createMarkdownPlugins } from './markdown.js'
import { getSearchDataJS, generateDocSearchData, generateTitleSearchData } from './search.js'
import { getInjectedImport } from './util/vendors.js'
import { findUp } from './util/find-up.js'

const require = createRequire(import.meta.url)

Expand Down Expand Up @@ -112,14 +111,10 @@ export async function getViteConfigWithPlugins (isServer: boolean, ctx: Context)
const inlineConfig = await mergeHistoireViteConfig(userViteConfig, ctx)
const plugins: VitePlugin[] = []

const hasPnpm = !!(await findUp(ctx.root, ['pnpm-lock.yaml']))

function optimizeDeps (deps: string[]): string[] {
const result = []
for (const dep of deps) {
if (!hasPnpm) {
result.push(dep)
}
result.push(dep)
try {
result.push(dirname(require.resolve(`${dep}/package.json`)))
} catch (e) {
Expand Down

0 comments on commit a1014ab

Please sign in to comment.