【发布时间】:2016-03-06 19:49:49
【问题描述】:
我在尝试部署一个简单的 react + redux 应用时遇到了一些问题。
当在开发中运行应用程序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 ,页面看起来就像在 dev 中一样,但是 this.props.startTimer() 不会触发,因为它在开发中做得很好,没有任何反应。脚本在那里,一切看起来都很好,但没有任何反应。
这可能是什么原因造成的?
我尝试将 NODE_ENV 设置为基础、开发和生产。 没有变化。
需要帮助
【问题讨论】:
-
是否有公开的 repo 可供查看?也许是指向导致问题的组件的指针?
标签: deployment reactjs redux