-
Notifications
You must be signed in to change notification settings - Fork 801
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1165 from gaearon/january-fixes
January fixes
- Loading branch information
Showing
11 changed files
with
417 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/all-possible-containers/src/components/LazyComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from 'react' | ||
import { EDIT_ME } from './_editMe' | ||
import Counter from './Counter' | ||
|
||
const LazyComponent = () => ( | ||
<div> | ||
<fieldset> | ||
<legend>Lazy Component</legend> | ||
{EDIT_ME} | ||
<Counter /> | ||
</fieldset> | ||
</div> | ||
) | ||
|
||
export default LazyComponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
'use strict' | ||
|
||
var evalAllowed = false; | ||
try { | ||
eval('evalAllowed = true'); | ||
} catch (e) { | ||
// eval not allowed due to CSP | ||
} | ||
if (!module.hot || process.env.NODE_ENV === 'production') { | ||
module.exports = require('./dist/react-hot-loader.production.min.js'); | ||
} else { | ||
var evalAllowed = false; | ||
try { | ||
eval('evalAllowed = true'); | ||
} catch (e) { | ||
// eval not allowed due to CSP | ||
} | ||
|
||
// RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods | ||
var platformSupported = !!Object.setPrototypeOf && evalAllowed; | ||
// RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods | ||
var jsFeaturesPresent = typeof window !== 'undefined' && !!Object.setPrototypeOf; | ||
|
||
if (!module.hot || process.env.NODE_ENV === 'production' || !platformSupported) { | ||
if (module.hot) { | ||
if (!jsFeaturesPresent && evalAllowed) { | ||
// we are not in prod mode, but RHL could not be activated | ||
console.warn('React-Hot-Loaded is not supported in this environment'); | ||
console.warn('React-Hot-Loader is not supported in this environment'); | ||
module.exports = require('./dist/react-hot-loader.production.min.js'); | ||
} else { | ||
module.exports = window.reactHotLoaderGlobal = require('./dist/react-hot-loader.development.js'); | ||
} | ||
module.exports = require('./dist/react-hot-loader.production.min.js'); | ||
} else { | ||
module.exports = require('./dist/react-hot-loader.development.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.