Support running prod locally through ./api/cli.js (#14728)

This commit is contained in:
Rijk van Zanten
2022-07-28 15:17:31 -04:00
committed by GitHub
parent 0f394d90d8
commit 15be1c60b0
2 changed files with 4 additions and 2 deletions

View File

@@ -179,7 +179,7 @@ export default async function createApp(): Promise<express.Application> {
});
if (env.SERVE_APP) {
const adminPath = require.resolve('@directus/app');
const adminPath = require.resolve('@directus/app', require.main ? { paths: [require.main.filename] } : undefined);
const adminUrl = new Url(env.PUBLIC_URL).addPath('admin');
// Set the App's base path according to the APIs public URL

View File

@@ -310,7 +310,9 @@ class ExtensionManager {
}
private async getSharedDepsMapping(deps: string[]) {
const appDir = await fse.readdir(path.join(resolvePackage('@directus/app'), 'dist', 'assets'));
const appDir = await fse.readdir(
path.join(resolvePackage('@directus/app', require.main?.filename), 'dist', 'assets')
);
const depsMapping: Record<string, string> = {};
for (const dep of deps) {