uni-helper / vite-plugin-uni-pages

为 Vite 下的 uni-app 提供基于文件系统的路由
https://uni-helper.js.org/vite-plugin-uni-pages
MIT License
104 stars 15 forks source link

升级0.2.4版本后, 报: Sourcemap for "../*.vue" points to missing source files​ #100

Closed lincenying closed 1 year ago

lincenying commented 1 year ago

描述问题

升级0.2.4版本后, 报错

Sourcemap for "D:/Web/template/vite-uniapp-vue3/src/App.vue" points to missing source files​
22:04:28 [vite] URI malformed
​Sourcemap for "D:/Web/template/vite-uniapp-vue3/src/components/empty-popup.vue" points to missing source files​
​Sourcemap for "D:/Web/template/vite-uniapp-vue3/src/components/no-data.vue" points to missing source files​  
​Sourcemap for "D:/Web/template/vite-uniapp-vue3/src/components/title-bar.vue" points to missing source files​
​Sourcemap for "D:/Web/template/vite-uniapp-vue3/node_modules/.pnpm/uniapp-nutui@0.2.0_vue@3.3.4/node_modules/uniapp-nutui/components/loadingpage/loadingpage.vue" points to missing source files​
​Sourcemap for "D:/Web/template/vite-uniapp-vue3/node_modules/.pnpm/uniapp-nutui@0.2.0_vue@3.3.4/node_modules/uniapp-nutui/components/icon/icon.vue" points to missing source files​

复现

https://github.com/lincenying/vite-uniapp-vue3

安装依赖后, 升级@uni-helper/vite-plugin-uni-pages 到 0.2.4版本

npm run serve

系统信息

System:
    OS: Windows 10 10.0.19045
    CPU: (12) x64 Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz
    Memory: 3.10 GB / 15.87 GB
  Binaries:
    Node: 16.20.0 - D:\Soft\nodejs\node.EXE
    npm: 8.19.4 - D:\Soft\nodejs\npm.CMD
    pnpm: 8.6.10 - D:\Web\template\vite-uniapp-vue3\node_modules\.bin\pnpm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (115.0.1901.188)
    Internet Explorer: 11.0.19041.1566

使用的包管理器

pnpm

核对

KeJunMao commented 1 year ago

影响运行吗,不影响我晚点看下

KeJunMao commented 1 year ago

try 0.2.5

lincenying commented 1 year ago
image

sourcemap的错误没了, 但是URI malformed的错误还在

结果测试, 0.2.5中的sourcePath出现了

image

应该是0.2.4版本加了缓存的原因吧

vite把这个decodeURI后, 如果代码中包含有'%'就会解析错误

KeJunMao commented 1 year ago

神奇,这个怎么复现呢

KeJunMao commented 1 year ago

缓存只用来判断了下是否需要更新,应该不是这个原因

lincenying commented 1 year ago

神奇,这个怎么复现呢

在 代码任意地方添加一个% 就 可以复现了

KeJunMao commented 1 year ago

试试 0.2.6 应该修复了

lincenying commented 1 year ago

嗯, 可以了, 感谢

我也刚测试到


if (s.hasChanged()) {
        return {
          code: s.toString(),
          map: s.generateMap({
            source: code,
            includeContent: true,
            file: id
          })
        };
      }
``` 这里的问题...发现code的内容和截图的内容一致...就想应该是路径和代码写反了...