@tramvai/react 1.31.1 → 1.35.4

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.
package/lib/react.es.js CHANGED
@@ -117,8 +117,18 @@ const withError = ({ fallbackComponent, } = {}) => (WrappedComponent) => {
117
117
  return hoistStatics(WrapperWithError, WrappedComponent);
118
118
  };
119
119
 
120
- const lazy = (load, options = {}) => loadable(load, {
121
- fallback: options.loading,
122
- });
120
+ const lazy = (load, options = {}) => {
121
+ if (process.env.NODE_ENV === 'development') {
122
+ if (!('requireAsync' in load)) {
123
+ console.error(`Lazy import was not processed by lazy-component babel plugin.
124
+ Check lazy helper usage, expected signature is "lazy(() => import('./path/to/component'))",
125
+ the first argument should be transformed into a special object, but the current value is
126
+ "${load.toString()}"`);
127
+ }
128
+ }
129
+ return loadable(load, {
130
+ fallback: options.loading,
131
+ });
132
+ };
123
133
 
124
134
  export { DIContext, ERROR_BOUNDARY_FALLBACK_COMPONENT_TOKEN, ERROR_BOUNDARY_TOKEN, ErrorBoundary, FallbackError, lazy, useDi, useDiContainer, withDi, withError };
package/lib/react.js CHANGED
@@ -128,9 +128,19 @@ const withError = ({ fallbackComponent, } = {}) => (WrappedComponent) => {
128
128
  return hoistStatics__default["default"](WrapperWithError, WrappedComponent);
129
129
  };
130
130
 
131
- const lazy = (load, options = {}) => loadable__default["default"](load, {
132
- fallback: options.loading,
133
- });
131
+ const lazy = (load, options = {}) => {
132
+ if (process.env.NODE_ENV === 'development') {
133
+ if (!('requireAsync' in load)) {
134
+ console.error(`Lazy import was not processed by lazy-component babel plugin.
135
+ Check lazy helper usage, expected signature is "lazy(() => import('./path/to/component'))",
136
+ the first argument should be transformed into a special object, but the current value is
137
+ "${load.toString()}"`);
138
+ }
139
+ }
140
+ return loadable__default["default"](load, {
141
+ fallback: options.loading,
142
+ });
143
+ };
134
144
 
135
145
  exports.DIContext = DIContext;
136
146
  exports.ERROR_BOUNDARY_FALLBACK_COMPONENT_TOKEN = ERROR_BOUNDARY_FALLBACK_COMPONENT_TOKEN;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/react",
3
- "version": "1.31.1",
3
+ "version": "1.35.4",
4
4
  "description": "",
5
5
  "main": "lib/react.js",
6
6
  "typings": "lib/react.d.ts",
@@ -25,7 +25,7 @@
25
25
  "peerDependencies": {
26
26
  "@tinkoff/dippy": "0.7.35",
27
27
  "@tinkoff/utils": "^2.1.2",
28
- "@tramvai/core": "1.31.1",
28
+ "@tramvai/core": "1.35.4",
29
29
  "react": ">=16.8.0",
30
30
  "react-dom": ">=16.8.0",
31
31
  "tslib": "^2.0.3"