react-hot-loader
Advanced tools
Comparing version 0.1.7 to 0.1.8
18
index.js
@@ -0,13 +1,27 @@ | ||
var path = require('path'), | ||
loaderUtils = require('loader-utils'); | ||
module.exports = function () {}; | ||
module.exports.pitch = function (remainingRequest) { | ||
this.cacheable && this.cacheable(); | ||
var patchedModuleRequest = '!!' + require.resolve('./replaceCreateClass') + '!' + remainingRequest; | ||
var patchedModuleRequest = '!!' + require.resolve('./replaceCreateClass') + '!' + remainingRequest, | ||
originalFilename = path.basename(remainingRequest), | ||
query = loaderUtils.parseQuery(this.query); | ||
query.notify = query.notify || 'none'; | ||
return [ | ||
'var React = require("react")', | ||
'var hot = require(' + JSON.stringify(require.resolve('./hot')) + ')(React);', | ||
'var notify = require(' + JSON.stringify(require.resolve('./notify')) + ')(' + JSON.stringify(query.notify) + ');', | ||
'module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.createClass);', | ||
'if (module.hot) {', | ||
' module.hot.accept(' + JSON.stringify(patchedModuleRequest) + ', function () {', | ||
' module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.updateClass);', | ||
' try {', | ||
' module.exports = require(' + JSON.stringify(patchedModuleRequest) + ')(hot.updateClass);', | ||
' notify.success(' + JSON.stringify(originalFilename) + ')', | ||
' } catch (err) {', | ||
' notify.failure(' + JSON.stringify(originalFilename) + ', err)', | ||
' }', | ||
' });', | ||
@@ -14,0 +28,0 @@ '}', |
{ | ||
"name": "react-hot-loader", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Webpack loader that enables live-editing React components without unmounting or losing their state", | ||
@@ -11,2 +11,3 @@ "main": "index.js", | ||
"jsx-loader": "^0.10.2", | ||
"loader-utils": "^0.2.3", | ||
"react": "^0.10.0", | ||
@@ -13,0 +14,0 @@ "webpack": "^1.3.1" |
@@ -39,2 +39,6 @@ # react-hot-loader | ||
### Options | ||
* `notify`: Loader can use desktop Notification API to show notifications when a module has been reloaded, or if it loads with an error. By default, this feature is disabled because it doesn't work well with `webpack-dev-server` iframe mode used in the example. If you don't use `webpack-dev-server`'s iframe mode, you might want to enable notifications. Valid values are `none` (default), `errors` and `all`. If `notify` is `errors` or `all`, module load errors won't cause page refresh. | ||
## Running Example | ||
@@ -41,0 +45,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19366
11
286
66
4