chore: update package dependencies and enhance frontend script for missing installations

This commit is contained in:
Nawaz Dhandala
2026-04-02 23:16:06 +01:00
parent f5ef80e544
commit 8d07271aa1
6 changed files with 42 additions and 5 deletions

View File

@@ -180,6 +180,31 @@ function readEnvFile(pathToFile) {
return env;
}
function resolvePackageRoot(packageName) {
const resolutionPaths = [
process.cwd(),
__dirname,
path.resolve(__dirname, '..'),
path.resolve(__dirname, '../..'),
];
for (const resolutionPath of resolutionPaths) {
try {
const packageJsonPath = require.resolve(`${packageName}/package.json`, {
paths: [resolutionPath],
});
return path.dirname(packageJsonPath);
} catch (error) {
continue;
}
}
throw new Error(
`Unable to locate ${packageName} package for esbuild alias resolution.`,
);
}
/**
* Create esbuild configuration for a service
* @param {Object} options - Configuration options
@@ -204,6 +229,7 @@ function createConfig(options) {
const isDev = process.env.NODE_ENV !== 'production';
const isAnalyze = process.env.analyze === 'true';
const reactRoot = resolvePackageRoot('react');
return {
entryPoints: [entryPoint],
@@ -223,7 +249,9 @@ function createConfig(options) {
},
external: ['react-native-sqlite-storage', ...additionalExternal],
alias: {
'react': path.resolve('./node_modules/react'),
'react': reactRoot,
'react/jsx-runtime': path.join(reactRoot, 'jsx-runtime.js'),
'react/jsx-dev-runtime': path.join(reactRoot, 'jsx-dev-runtime.js'),
...additionalAlias,
},
plugins: [createMermaidPlugin(), createRefractorCompatibilityPlugin(), createCSSPlugin(), createFileLoaderPlugin()],