ChenPt / dailyNote

dailyNode for myself
https://github.com/ChenPt/dailyNote/issues
0 stars 0 forks source link

electron-vue里的__static路径问题 #33

Open ChenPt opened 5 years ago

ChenPt commented 5 years ago

static是electron-vue提供的一个变量,electron原生是没有的。 对应的是当前项目目录的static文件夹。 在开发环境下测试时,static这个变量是由webpack来进行处理的,实际上就是当前开发项目的根目录下的static文件夹。而在生产环境中,static变量被保存到nodejs提供的global对象里去,需要保证的是,得等到他已经确认挂载到了global对象上再去引用。 BUG: 打包后打开可执行文件,发现报错: `static is not defined 而在开发环境下是没有问题的。因为开发环境下的__static变量并没有挂载到global`对象上。 修改代码引用顺序就可以了。