emosheeep / vite-plugin-virtual-mpa

Out-of-box MPA plugin for Vite, generate multiple entries using only one template.
https://stackblitz.com/~/github.com/emosheeep/vite-plugin-virtual-mpa
MIT License
116 stars 15 forks source link

BUG: Cross-platform path parsing error, can not recognize backslash('\') on windows when using `scanOptions`. #41

Closed Xli33 closed 1 year ago

Xli33 commented 1 year ago

配置

scanOptions: {
          scanDirs: 'src/pages',
          entryFile: 'main.ts',
          filename: (name) => `pages/${name}.html`
        }

然后无论开发还是打包都会报错 Entry must be an absolute path relative to the project root, received '\src\pages\xxx\main.ts'

image

应该是因为configInit里面只判断了 / ,但windows上用的 \ 所以 path.join 返回路径里的分隔符是 \ ,从而导致匹配不到报错

image

emosheeep commented 1 year ago

确实没考虑到windows系统,我没有windows电脑,我还得想想怎么调试🤔

emosheeep commented 1 year ago

刚刚发了 1.8.3-beta.0 版本,你可以试试看有没有问题,没问题的话我就发正式版了

Xli33 commented 1 year ago

刚刚发了 1.8.3-beta.0 版本,你可以试试看有没有问题,没问题的话我就发正式版了

好的,刚试了ok,多谢大佬,辛苦大佬♪(・ω・)ノ