Skip to content

Commit 3e89438

Browse files
feat: Handle mem fs injection in dispatcher
1 parent b4a376f commit 3e89438

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/build/dispatcher/dispatcher.js

+16
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
getPackageManager,
2020
getProjectJsonFile,
2121
relocateImportsAndRequires,
22+
injectFilesInMem,
2223
} from '#utils';
2324
import { Messages } from '#constants';
2425
import { vulcan } from '#env';
@@ -332,6 +333,21 @@ class Dispatcher {
332333
config.localCustom = this.custom;
333334

334335
const builderSelected = this.builder || config.builder;
336+
337+
const { injectionDirs, removePathPrefix } = this.memoryFS;
338+
if (injectionDirs && injectionDirs.length > 0) {
339+
const content = await injectFilesInMem(injectionDirs);
340+
341+
const prefix =
342+
removePathPrefix &&
343+
typeof removePathPrefix === 'string' &&
344+
removePathPrefix !== ''
345+
? `'${removePathPrefix}'`
346+
: `''`;
347+
348+
config.contentToInject = `globalThis.FS_PATH_PREFIX_TO_REMOVE = ${prefix};\n${content}`;
349+
}
350+
335351
let builder;
336352
switch (builderSelected) {
337353
case 'webpack':

0 commit comments

Comments
 (0)