React Redux 'npm run deploy' 应用无法运行
React Redux 'npm run deploy' app not working
我在尝试部署简单的 React + redux 应用程序时遇到了一些问题。
我正在使用 react redux starter kit
当 运行 开发中的应用程序 npm run dev:nw
一切正常时,componentWillMount()
中的 this.props.startTimer()
函数会触发并定期更新模块中的状态。一切正常。
当我使用 npm run deploy
部署应用程序时,我没有收到任何错误,而且似乎一切正常。
app:config Create configuration. +0ms
app:config Apply environment overrides for NODE_ENV "production". +3ms
app:webpack:config Create configuration. +839ms
app:webpack:config Enable plugins for production (OccurenceOrder, Dedupe & UglifyJS). +2ms
app:webpack:config Apply ExtractTextPlugin to CSS loaders. +69ms
app:bin:compile Run compiler +4ms
app:build:webpack-compiler Webpack compile completed. +14s
app:build:webpack-compiler Hash: ce8ff073e185128cb7b1
Version: webpack 1.12.9
Time: 13543ms
大量 react/babel/redux 内置消息如下。最后输出以
结尾
app:build:webpack-compiler No errors or warnings encountered. +2ms
app:bin:compile Copy static assets to dist folder. +0ms
我导航到 http://domain/dist ,页面显示与在开发中一样,但 this.props.startTimer() 不会像刚才那样触发开发中很好,没有任何反应。脚本在那里,一切看起来都很好,但没有任何反应。
这可能是什么原因造成的?
我已经尝试将 NODE_ENV 设置为基础、开发和生产。
没有变化。
需要帮助
问题是 nginx 配置错误,无法正确处理 dist/ 文件夹。将内容移至文档根目录,它起作用了。
我在尝试部署简单的 React + redux 应用程序时遇到了一些问题。
我正在使用 react redux starter kit
当 运行 开发中的应用程序 npm run dev:nw
一切正常时,componentWillMount()
中的 this.props.startTimer()
函数会触发并定期更新模块中的状态。一切正常。
当我使用 npm run deploy
部署应用程序时,我没有收到任何错误,而且似乎一切正常。
app:config Create configuration. +0ms
app:config Apply environment overrides for NODE_ENV "production". +3ms
app:webpack:config Create configuration. +839ms
app:webpack:config Enable plugins for production (OccurenceOrder, Dedupe & UglifyJS). +2ms
app:webpack:config Apply ExtractTextPlugin to CSS loaders. +69ms
app:bin:compile Run compiler +4ms
app:build:webpack-compiler Webpack compile completed. +14s
app:build:webpack-compiler Hash: ce8ff073e185128cb7b1
Version: webpack 1.12.9
Time: 13543ms
大量 react/babel/redux 内置消息如下。最后输出以
结尾app:build:webpack-compiler No errors or warnings encountered. +2ms
app:bin:compile Copy static assets to dist folder. +0ms
我导航到 http://domain/dist ,页面显示与在开发中一样,但 this.props.startTimer() 不会像刚才那样触发开发中很好,没有任何反应。脚本在那里,一切看起来都很好,但没有任何反应。
这可能是什么原因造成的?
我已经尝试将 NODE_ENV 设置为基础、开发和生产。 没有变化。
需要帮助
问题是 nginx 配置错误,无法正确处理 dist/ 文件夹。将内容移至文档根目录,它起作用了。