thegreatjavascript / FakeScreenshot

🔥对抗假消息系列项目之一:截屏 = 实锤?相信你就输了!(”突破性“更新💥:支持修改任何网站!) 下载安装包,手动安装到Chrome本地扩展中(注意打开开发者模式)
https://github.com/thegreatjavascript/FakeScreenshot/raw/master/dist-zip/fakescreenshot-v1.0.0.zip
1.93k stars 161 forks source link

编译期报错,无法解析 `@` 符号 #7

Closed owen8877 closed 5 years ago

owen8877 commented 5 years ago

刚看到这个项目很感兴趣,但是 vue 接触不多,请见谅。

我 clone 了这个 repo 之后直接 npm i,安装了 vue-cli 之后运行了 dev 任务(或者 npm run dev 也会有同样的报错):

These dependencies were not found:

* @/components/jianshu/simple in ./src/router/index.js
* @/components/v2ex/simple in ./src/router/index.js
* @/components/zhihu/simple in ./src/router/index.js

To install them, you can run: npm install --save @/components/jianshu/simple @/components/v2ex/simple @/components/zhihu/simple

不知道是不是 node 开关的问题?还是需要配置 babel-plugin-root-import 等包。

tuxinghuan commented 5 years ago

你可以尝试一下把router/index.js里的所有@换为..;

shuiRong commented 5 years ago

你可以尝试一下把router/index.js里的所有@换为..; @owen8877 @tuxinghuan 很奇怪,晚会儿我看看怎么回事。

Saferman commented 5 years ago

我也遇到相同bug,把@修改为..也是不行的,错误如下: @tuxinghuan @shuiRong image

shuiRong commented 5 years ago

@owen8877 @Saferman @tuxinghuan 我重新Clone项目后没有重现,但我可能猜到问题所在了。 代码改动看这里。我猜测是Webpack的问题,Webpack应该在路径不全的情况下,尝试按照某模式去尝试匹配路径的,比如:simple.js、simple.vue、simple/index.js、simple/index.vue (我猜测是因为我文件名用了大写的Index.vue,而不是小写的index.vue)。 你们可以重新pull下代码,如果没有问题,记得回来Close this issue

Saferman commented 5 years ago

首先感谢 @shuiRong 的解答,但是你的解决方案仍然有些错误 虽然我是零基础vue,js,我刚刚自学了vue然后阅读你的源码发现了问题,和你给的解答基本是一样的。我发现你的acfun目录下是index.vue,而zhihu、jianshu、v2ex是Index.vue。你的更改将 component: () => import('@/components/acfun/simple')改为了component: () => import('@/components/acfun/simple/Index'),但是npm run dev的时候仍然无法定位到acfun/simple下的 index.vue 强烈建议在下次的版本中统一componets中的各个模板格式

shuiRong commented 5 years ago

@Saferman 感谢提醒。acfun部分的代码是其他小伙伴写的2333,没统一上,明天我改正。

owen8877 commented 5 years ago

谢谢两位,已经可以正常运行了。