fix: config
This commit is contained in:
parent
88c4f13f74
commit
83df532e97
|
@ -39,17 +39,15 @@ module.exports = class Build extends Flecks {
|
||||||
static async buildRuntime(originalConfig, platforms, flecks = {}) {
|
static async buildRuntime(originalConfig, platforms, flecks = {}) {
|
||||||
const cleanConfig = JSON.parse(JSON.stringify(originalConfig));
|
const cleanConfig = JSON.parse(JSON.stringify(originalConfig));
|
||||||
// Dealias the config keys.
|
// Dealias the config keys.
|
||||||
const dealiasedConfig = this.environmentConfiguration(
|
const dealiasedConfig = Object.fromEntries(
|
||||||
Object.fromEntries(
|
Object.entries(cleanConfig)
|
||||||
Object.entries(cleanConfig)
|
.map(([maybeAliasedPath, config]) => {
|
||||||
.map(([maybeAliasedPath, config]) => {
|
const index = maybeAliasedPath.indexOf(':');
|
||||||
const index = maybeAliasedPath.indexOf(':');
|
return [
|
||||||
return [
|
-1 === index ? maybeAliasedPath : maybeAliasedPath.slice(0, index),
|
||||||
-1 === index ? maybeAliasedPath : maybeAliasedPath.slice(0, index),
|
config,
|
||||||
config,
|
];
|
||||||
];
|
}),
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
const resolver = new Resolver({root: FLECKS_CORE_ROOT});
|
const resolver = new Resolver({root: FLECKS_CORE_ROOT});
|
||||||
const {paths, roots} = await explicate({
|
const {paths, roots} = await explicate({
|
||||||
|
@ -59,7 +57,9 @@ module.exports = class Build extends Flecks {
|
||||||
importer: (request) => require(request),
|
importer: (request) => require(request),
|
||||||
});
|
});
|
||||||
const runtime = {
|
const runtime = {
|
||||||
config: Object.fromEntries(paths.map((path) => [path, dealiasedConfig[path] || {}])),
|
config: this.environmentConfiguration(
|
||||||
|
Object.fromEntries(paths.map((path) => [path, dealiasedConfig[path] || {}])),
|
||||||
|
),
|
||||||
flecks: Object.fromEntries(paths.map((path) => [
|
flecks: Object.fromEntries(paths.map((path) => [
|
||||||
path,
|
path,
|
||||||
flecks[path] || roots[path]?.bootstrap || {},
|
flecks[path] || roots[path]?.bootstrap || {},
|
||||||
|
|
|
@ -22,4 +22,5 @@ export const hooks = {
|
||||||
*/
|
*/
|
||||||
ssr: true,
|
ssr: true,
|
||||||
}),
|
}),
|
||||||
|
'@flecks/web.config': async (req, flecks) => flecks.get('@flecks/react'),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user