Skip to content

Commit 0574e65

Browse files
committed
fix: windows styles resolving
1 parent 097fc30 commit 0574e65

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/slidev/node/plugins/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { InlineConfig, mergeConfig, Plugin } from 'vite'
22
import { getIndexHtml } from '../common'
33
import { dependencies } from '../../../client/package.json'
44
import { ResolvedSlidevOptions } from '../options'
5+
import { toAtFS } from '../utils'
56

67
const EXCLUDE = [
78
'@slidev/types',
@@ -14,7 +15,7 @@ export function createConfigPlugin(options: ResolvedSlidevOptions): Plugin {
1415
const injection: InlineConfig = {
1516
resolve: {
1617
alias: {
17-
'@slidev/client/': `${options.clientRoot}/`,
18+
'@slidev/client/': `${toAtFS(options.clientRoot)}/`,
1819
},
1920
},
2021
optimizeDeps: {

packages/slidev/node/plugins/entry.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { existsSync } from 'fs'
22
import { join, resolve } from 'path'
3+
import { slash } from '@antfu/utils'
34
import { Plugin } from 'vite'
45
import { ResolvedSlidevOptions } from '../options'
56
import { toAtFS } from '../utils'
67

78
export function createEntryPlugin({ clientRoot, themeRoots, userRoot }: ResolvedSlidevOptions): Plugin {
8-
const mainEntry = resolve(clientRoot, 'main.ts')
9+
const mainEntry = slash(resolve(clientRoot, 'main.ts'))
910

1011
return {
1112
name: 'slidev:entry',
@@ -16,9 +17,9 @@ export function createEntryPlugin({ clientRoot, themeRoots, userRoot }: Resolved
1617

1718
async function scanStyle(root: string) {
1819
const styles = [
19-
join(root, 'styles/index.ts'),
20-
join(root, 'styles/index.js'),
21-
join(root, 'styles/index.css'),
20+
join(root, 'styles', 'index.ts'),
21+
join(root, 'styles', 'index.js'),
22+
join(root, 'styles', 'index.css'),
2223
join(root, 'styles.css'),
2324
join(root, 'style.css'),
2425
]

0 commit comments

Comments
 (0)