我正在尝试开发基于反应的应用程序,并希望将其作为桌面应用程序运行 .
我想要的就是在nw.js中运行这个样板文件 . :https://github.com/react-boilerplate/react-boilerplate没有使用npm构建 .
我做了什么? 1 - 下载https://github.com/react-boilerplate/react-boilerplate到我当地 .
2-更改了internals / webpack / webpack.base.babel.js中的行
从
target:'web',//使Webpack可以访问web变量,例如窗口
至
target:'node-webkit',//使webpack可以访问web变量,例如窗口
3-然后将此package.json文件放入/ server目录
{
"name": "Git Branch Deleter",
"main": "http://localhost:3000",
"node-remote": "http://<local>:3000",
"webkit": {
"plugin": true
}
}
4- $ npm在其他控制台nw ./server中开始5-
但是得到这个错误:
Uncaught ReferenceError: require is not defined
at Object.96 (external "querystring":1)
at __webpack_require__ (bootstrap 8ef778c469cd23409e4f:686)
at fn (bootstrap 8ef778c469cd23409e4f:105)
at Object.<anonymous> (client.js:14)
at Object../node_modules/webpack-hot-middleware/client.js?reload=true (client.js:191)
at __webpack_require__ (bootstrap 8ef778c469cd23409e4f:686)
at fn (bootstrap 8ef778c469cd23409e4f:105)
at Object.97 (main.js:66130)
at __webpack_require__ (bootstrap 8ef778c469cd23409e4f:686)
at ./app/app.js (bootstrap 8ef778c469cd23409e4f:781)