react-cosmos 5.6.4 → 5.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -152,6 +152,10 @@
152
152
  "hotReload": {
153
153
  "description": "Enable webpack's Hot Module Replacement. [default: true]",
154
154
  "type": "boolean"
155
+ },
156
+ "reloadOnFail": {
157
+ "description": "When using webpack's Hot Module Replacement, enable automatic location reload after webpack fails to update modules. [default: true]",
158
+ "type": "boolean"
155
159
  }
156
160
  }
157
161
  },
@@ -4,6 +4,7 @@ declare type WebpackCosmosConfig = {
4
4
  overridePath: null | string;
5
5
  includeHashInOutputFilename: boolean;
6
6
  hotReload: boolean;
7
+ reloadOnFail: boolean;
7
8
  };
8
9
  export declare function createWebpackCosmosConfig(cosmosConfig: CosmosConfig): WebpackCosmosConfig;
9
10
  export {};
@@ -20,7 +20,8 @@ function createWebpackCosmosConfig(cosmosConfig) {
20
20
  configPath: getWebpackConfigPath(configInput, rootDir),
21
21
  overridePath: getWebpackOverridePath(configInput, rootDir),
22
22
  includeHashInOutputFilename: getIncludeHashInOutputFilename(configInput),
23
- hotReload: getHotReload(configInput)
23
+ hotReload: getHotReload(configInput),
24
+ reloadOnFail: getReloadOnFail(configInput)
24
25
  };
25
26
  }
26
27
 
@@ -85,4 +86,10 @@ function getHotReload(_ref4) {
85
86
  var _ref4$hotReload = _ref4.hotReload,
86
87
  hotReload = _ref4$hotReload === void 0 ? true : _ref4$hotReload;
87
88
  return hotReload;
89
+ }
90
+
91
+ function getReloadOnFail(_ref5) {
92
+ var _ref5$reloadOnFail = _ref5.reloadOnFail,
93
+ reloadOnFail = _ref5$reloadOnFail === void 0 ? true : _ref5$reloadOnFail;
94
+ return reloadOnFail;
88
95
  }
@@ -93,13 +93,14 @@ function _getDevWebpackConfig() {
93
93
 
94
94
  function getEntry(cosmosConfig) {
95
95
  var _createWebpackCosmosC = (0, _webpack.createWebpackCosmosConfig)(cosmosConfig),
96
- hotReload = _createWebpackCosmosC.hotReload; // The React devtools hook needs to be imported before any other module that
96
+ hotReload = _createWebpackCosmosC.hotReload,
97
+ reloadOnFail = _createWebpackCosmosC.reloadOnFail; // The React devtools hook needs to be imported before any other module that
97
98
  // might import React
98
99
 
99
100
 
100
101
  var devtoolsHook = (0, _shared.resolveClientPath)('reactDevtoolsHook');
101
102
  var clientIndex = (0, _shared.resolveClientPath)('index');
102
- return hotReload ? [devtoolsHook, getHotMiddlewareEntry(), clientIndex] : [devtoolsHook, clientIndex];
103
+ return hotReload ? [devtoolsHook, getHotMiddlewareEntry(reloadOnFail), clientIndex] : [devtoolsHook, clientIndex];
103
104
  }
104
105
 
105
106
  function getOutput(_ref) {
@@ -137,8 +138,8 @@ function getPlugins(cosmosConfig, baseWebpackConfig, userWebpack) {
137
138
  return (0, _htmlPlugin.ensureHtmlWebackPlugin)(cosmosConfig, plugins);
138
139
  }
139
140
 
140
- function getHotMiddlewareEntry() {
141
+ function getHotMiddlewareEntry(reloadOnFail) {
141
142
  var clientPath = require.resolve('@skidding/webpack-hot-middleware/client');
142
143
 
143
- return "".concat(clientPath, "?reload=true&overlay=false");
144
+ return "".concat(clientPath, "?reload=").concat(reloadOnFail, "&overlay=false");
144
145
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-cosmos",
3
- "version": "5.6.4",
3
+ "version": "5.6.5",
4
4
  "description": "CLI for running React Cosmos inside webpack-powered apps",
5
5
  "repository": "https://github.com/react-cosmos/react-cosmos/tree/main/packages/react-cosmos",
6
6
  "license": "MIT",
@@ -38,5 +38,5 @@
38
38
  "cosmos-export": "./bin/cosmos-export.js",
39
39
  "cosmos-native": "./bin/cosmos-native.js"
40
40
  },
41
- "gitHead": "83d46ed7c5cdac02269117dae7f95a0cd788f24d"
41
+ "gitHead": "256323bd819a05ee5994b98d8bf3e539d26e9687"
42
42
  }