fix: react dupes
This commit is contained in:
parent
a2b558a9ec
commit
fee67bbbd6
|
@ -6,3 +6,12 @@ const clientMains = [
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = splitConfig(pkg, clientMains);
|
module.exports = splitConfig(pkg, clientMains);
|
||||||
|
|
||||||
|
module.exports[1].use.push((neutrino) => {
|
||||||
|
neutrino.config.merge({
|
||||||
|
externals: {
|
||||||
|
react: 'react',
|
||||||
|
'react-dom': 'react-dom',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -8,20 +8,26 @@ export {LatusContext, React};
|
||||||
export default {
|
export default {
|
||||||
hooks: {
|
hooks: {
|
||||||
'@latus/http/client/up': async (latus) => {
|
'@latus/http/client/up': async (latus) => {
|
||||||
const Components = latus.invoke('@latus/react/client/components');
|
const Components = Object.fromEntries(
|
||||||
const Providers = await latus.invokeOrdered('@latus/react/client/providers');
|
await Promise.all(
|
||||||
const children = await Promise.all(
|
Object.entries(latus.invoke('@latus/react/client/components'))
|
||||||
Object.entries(Components)
|
.map(async ([key, Component]) => [key, await Component]),
|
||||||
.map(async ([key, Component]) => React.createElement(await Component, {key})),
|
),
|
||||||
);
|
);
|
||||||
const RootElement = [
|
const Providers = await latus.invokeOrdered('@latus/react/client/providers');
|
||||||
[LatusContext.Provider, {value: latus}],
|
const RootComponent = () => {
|
||||||
].concat(Providers)
|
const children = Object.entries(Components)
|
||||||
.reverse()
|
.map(([key, Component]) => React.createElement(Component, {key}));
|
||||||
.reduce((children, [Provider, props], i) => [
|
const RootElements = [
|
||||||
React.createElement(Provider, {key: `@latus/react/provider(${i})`, ...props}, children),
|
[LatusContext.Provider, {value: latus}],
|
||||||
], children);
|
].concat(Providers)
|
||||||
return render(RootElement[0], window.document.getElementById('root'));
|
.reverse()
|
||||||
|
.reduce((children, [Provider, props], i) => [
|
||||||
|
React.createElement(Provider, {key: `@latus/react/provider(${i})`, ...props}, children),
|
||||||
|
], children);
|
||||||
|
return RootElements[0];
|
||||||
|
};
|
||||||
|
return render(React.createElement(RootComponent), window.document.getElementById('root'));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
"debug": "4.3.1",
|
"debug": "4.3.1",
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
"react": "^17.0.1",
|
|
||||||
"react-dom": "^17.0.1",
|
|
||||||
"react-redux": "^7.2.2",
|
"react-redux": "^7.2.2",
|
||||||
"reduce-reducers": "^1.0.4",
|
"reduce-reducers": "^1.0.4",
|
||||||
"redux": "^4.0.5"
|
"redux": "^4.0.5"
|
||||||
|
@ -43,7 +41,13 @@
|
||||||
"eslint-import-resolver-webpack": "0.13.0",
|
"eslint-import-resolver-webpack": "0.13.0",
|
||||||
"mocha": "^8",
|
"mocha": "^8",
|
||||||
"neutrino": "^9.4.0",
|
"neutrino": "^9.4.0",
|
||||||
|
"react": "^17.0.1",
|
||||||
|
"react-dom": "^17.0.1",
|
||||||
"webpack": "^4",
|
"webpack": "^4",
|
||||||
"webpack-cli": "^3"
|
"webpack-cli": "^3"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^17.0.1",
|
||||||
|
"react-dom": "^17.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -910,10 +910,10 @@
|
||||||
minimatch "^3.0.4"
|
minimatch "^3.0.4"
|
||||||
strip-json-comments "^3.1.1"
|
strip-json-comments "^3.1.1"
|
||||||
|
|
||||||
"@latus/core@^1.0.0":
|
"@latus/core@^2.0.0":
|
||||||
version "1.0.0"
|
version "2.0.0"
|
||||||
resolved "https://npm.i12e.cha0s.io/@latus%2fcore/-/core-1.0.0.tgz#6fd2990a8bf8069bd331238141496a4230c4a5db"
|
resolved "https://npm.i12e.cha0s.io/@latus%2fcore/-/core-2.0.0.tgz#865c5eac67720d39867cee6340dcca18fa556791"
|
||||||
integrity sha512-sf0g1ZhvqwbHcQVL9ivV+6QWcKu4o69aDSOV/vp/zalBT1C7yDxvbNuwNkNP5GZZI2knd7oRiA1KAd3Z4e18rg==
|
integrity sha512-4w0zmXOfCOPsDVopXOr8x2P4urvlTK1gYdCq5Jo4vtmyQgqZj5FjBC+PliPnyxppoRc9nM5AAX4604o34CXXQg==
|
||||||
dependencies:
|
dependencies:
|
||||||
debug "4.3.1"
|
debug "4.3.1"
|
||||||
js-yaml "3.14.0"
|
js-yaml "3.14.0"
|
||||||
|
@ -2463,9 +2463,9 @@ duplexify@^3.4.2, duplexify@^3.6.0:
|
||||||
stream-shift "^1.0.0"
|
stream-shift "^1.0.0"
|
||||||
|
|
||||||
electron-to-chromium@^1.3.621:
|
electron-to-chromium@^1.3.621:
|
||||||
version "1.3.629"
|
version "1.3.631"
|
||||||
resolved "https://npm.i12e.cha0s.io/electron-to-chromium/-/electron-to-chromium-1.3.629.tgz#a08d13b64d90e3c77ec5b9bffa3efbc5b4a00969"
|
resolved "https://npm.i12e.cha0s.io/electron-to-chromium/-/electron-to-chromium-1.3.631.tgz#b28ebc7bfb348bb0aede2fae8888d775ddb6f5ee"
|
||||||
integrity sha512-iSPPJtPvHrMAvYOt+9cdbDmTasPqwnwz4lkP8Dn200gDNUBQOLQ96xUsWXBwXslAo5XxdoXAoQQ3RAy4uao9IQ==
|
integrity sha512-mPEG/52142po0XK1jQkZtbMmp38MZtQ3JDFItYxV65WXyhxDYEQ54tP4rb93m0RbMlZqQ+4zBw2N7UumSgGfbA==
|
||||||
|
|
||||||
elliptic@^6.5.3:
|
elliptic@^6.5.3:
|
||||||
version "6.5.3"
|
version "6.5.3"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user