Skip to content

Commit

Permalink
fix(slidev): monaco plugin type import path in windows os (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
hannoeru committed May 21, 2021
1 parent c636409 commit 574f8b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/slidev/node/plugins/monaco.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { join } from 'path'
import { slash } from '@antfu/utils'
import { Plugin, resolvePackageData } from 'vite'

export function createMonacoTypesLoader(): Plugin {
Expand All @@ -24,7 +26,7 @@ export function createMonacoTypesLoader(): Plugin {

return [
'import * as monaco from \'monaco-editor\'',
`import Type from "${info.dir}/${typePath}?raw"`,
`import Type from "${slash(join(info.dir, typePath))}?raw"`,
...Object.keys(info.data.dependencies || {}).map(i => `import "/@slidev-monaco-types/${i}"`),
`monaco.languages.typescript.typescriptDefaults.addExtraLib(\`declare module "${pkg}" { \$\{Type\} }\`)`,
].join('\n')
Expand Down

0 comments on commit 574f8b2

Please sign in to comment.