【发布时间】:2016-07-30 01:26:08
【问题描述】:
使用this boilerplate 作为参考,我创建了一个Electron 应用程序。它使用 webpack 来打包脚本并使用 express server 来托管它。
Webpack 配置实际上与 this 和服务器 this 相同。
Electron 的脚本加载:
mainWindow.loadURL('file://' + __dirname + '/app/index.html');
并且 index.html 会加载服务器托管的脚本:
<script src="http://localhost:3000/dist/bundle.js"></script>
我运行electron index.js 来构建应用程序并运行node server 来启动使用webpack 捆绑脚本的服务器。
它工作正常,我的 React 组件 App 已安装。但是我如何将 react-router 集成到其中呢?
我以与在浏览器应用程序中相同的方式实现它。我收到此错误:
[react-router] Location "/Users/arjun/Documents/Github/electron-app/app/index.html" did not match any routes
它以文件路径为路径。浏览样板代码并没有帮助。我错过了什么?
【问题讨论】:
-
得到完全相同的东西。你找到解决方案了吗,@arjun-u – 还是你只是选择了 hashHistory?
-
我使用了 hashHistory。
标签: javascript reactjs react-router electron