fix(webpack): add virtualEntry before main entry

fixes running with the JSC runtime, fixes #9469
This commit is contained in:
rigor789
2021-08-03 15:41:14 +02:00
parent 00b7c7b135
commit 5a3a35d376
3 changed files with 36 additions and 6 deletions

View File

@ -0,0 +1,24 @@
import { ChainedSet } from 'webpack-chain';
/**
* Helper to insert values after a specific item in a ChainedSet.
*
* @param chainedSet
* @param after
* @param itemToAdd
*/
export function chainedSetAddAfter(
chainedSet: ChainedSet<any>,
after: any,
itemToAdd: any
) {
const values = chainedSet.values();
if (values.includes(after)) {
values.splice(values.indexOf(after) + 1, 0, itemToAdd);
} else {
values.push(itemToAdd);
}
chainedSet.clear().merge(values);
}