tangxiangmin / vite-plugin-remote-module

Load HTTP remote module in the Vite project
17 stars 4 forks source link

Path contains invalid characters #1

Open lovedrose opened 2 years ago

lovedrose commented 2 years ago

作者您好~你应该是在linux开发的吧?我尝试过在windows和mac运行,发现无法生成目录,问题在于./index.js的getLocalFileByUrl方法,里面是直接用host作为文件夹名字,上述系统不允许使用“:”[手动狗头]

tangxiangmin commented 2 years ago

感谢你的反馈,我是在mac上工作的

const url = new URL(remoteUrl)
const {host, pathname} = url
return path.resolve(basePath, localPath, `./${host}${pathname}`)

这个host应该只是一个变量名,可以发一下你的remoteUrl吗,我有空的时候排查一下

lovedrose commented 2 years ago

感谢你的反馈,我是在mac上工作的

const url = new URL(remoteUrl)
const {host, pathname} = url
return path.resolve(basePath, localPath, `./${host}${pathname}`)

这个host应该只是一个变量名,可以发一下你的remoteUrl吗,我有空的时候排查一下

我在windows打印的remoteUrl为http://192.168.2.105:3000/demo.vue?suffix=.js 现在我通过硬编码const host = '192.168.2.105.3000'来暂时解决问题

tangxiangmin commented 2 years ago

已经在v1.1.1的版本中修复了这个问题,在创建目录时,会使用使用 _ 替换host中的 : ,可以更新一下插件版本试试

lovedrose commented 2 years ago

已经在v1.1.1的版本中修复了这个问题,在创建目录时,会使用使用 _ 替换host中的 : ,可以更新一下插件版本试试 太棒了