UNPKG

1.11 kBJavaScriptView Raw
1'use strict';
2
3if (process.env.NODE_ENV === 'production') {
4 module.exports = require('./dist/react-hot-loader.production.min.js');
5} else if (typeof window === 'undefined') {
6 // this is just server environment
7 module.exports = require('./dist/react-hot-loader.production.min.js');
8} else if (!module.hot) {
9 console.error('React-Hot-Loader: Hot Module Replacement is not enabled');
10 module.exports = require('./dist/react-hot-loader.production.min.js');
11} else {
12 var evalAllowed = false;
13 try {
14 eval('evalAllowed = true');
15 } catch (e) {
16 // eval not allowed due to CSP
17 }
18
19 // RHL needs setPrototypeOf to operate Component inheritance, and eval to patch methods
20 var jsFeaturesPresent = !!Object.setPrototypeOf;
21
22 if (!jsFeaturesPresent || !evalAllowed) {
23 // we are not in prod mode, but RHL could not be activated
24 console.warn('React-Hot-Loader is not supported in this environment.');
25 module.exports = require('./dist/react-hot-loader.production.min.js');
26 } else {
27 module.exports = window.reactHotLoaderGlobal = require('./dist/react-hot-loader.development.js');
28 }
29}