简体   繁体   English

在 Webpack 项目中包含 KRPano

[英]Include KRPano in Webpack project

I'm using Webpack as core for all my front-end js project since more than a year.一年多以来,我一直在使用 Webpack 作为我所有前端 js 项目的核心。 I'm starting to work with KRPano to create customized virtual tour.我开始使用 KRPano 来创建定制的虚拟旅游。 My goal is to be able to continue using my module style developement with Webpack, and include KRPano to this kind of project.我的目标是能够继续使用我的模块风格开发 Webpack,并将 KRPano 包含到此类项目中。

Actually the framework is a JS file with several functions to embed the viewer etc... And several js files that contains all krpano plugins.实际上,该框架是一个 JS 文件,其中包含用于嵌入查看器等的多个功能......以及几个包含所有 krpano 插件的 js 文件。

I tried to just export the krpano file functions and include that in my project, but i got several errors and impossible de compile.我试图只导出 krpano 文件函数并将其包含在我的项目中,但我遇到了几个错误并且无法反编译。

Wanted to know if someone ever done something like that, or if is there an alternative to webpack that will allow me to solve that issue?想知道是否有人做过类似的事情,或者是否有 webpack 的替代方法可以让我解决这个问题?

Thanks, Navalex.谢谢,纳瓦莱克斯。

There are many similar frameworks.类似的框架有很多。 And each for their own purposes.每个人都有自己的目的。 Frameworks like Electron, Cordova may suit you. Electron、Cordova 等框架可能适合您。 On Cordova, I created APK from Krpano tour and worked fine on my phone在 Cordova,我从 Krpano tour 创建了 APK,并且在我的手机上运行良好

Maybe your problem is that krpano is already "webpacked" and depending on which framework are you working you need the builded version and a server running.也许您的问题是 krpano 已经是“webpacked”,并且根据您使用的框架,您需要构建的版本和运行的服务器。

What i have done is:我所做的是:

  • create react app创建反应应用程序
  • import vtour folder inisde src (for example)在 src 中导入 vtour 文件夹(例如)
  • navigate with a single button into vtour/index.html使用单个按钮导航到 vtour/index.html
  • build js app (react in my case)构建 js 应用程序(在我的情况下做出反应)
  • add vtour files in the same route in builded app在构建的应用程序中的相同路径中添加 vtour 文件
  • sumbit to githubpages or glitch.me or something to test提交到 githubpages 或 glitch.me 或其他要测试的东西

Result Example: https://imaciap.github.io/Manresa360Deploy/结果示例: https://imaciap.github.io/Manresa360Deploy/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM