Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document the meaning of different strategies #10

Open
gajus opened this issue Oct 17, 2022 · 2 comments
Open

Document the meaning of different strategies #10

gajus opened this issue Oct 17, 2022 · 2 comments

Comments

@gajus
Copy link

gajus commented Oct 17, 2022

At the moment, it does not say what does single-vendor do.

@milahu
Copy link

milahu commented Dec 5, 2022

strategy single-vendor is not implemented

const generateManualChunks = async (
splitOptions: ChunkSplit,
root?: string
) => {
const { strategy = "default", customSplitting = {} } = splitOptions;
if (strategy === "all-in-one") {
return wrapCustomSplitConfig(
() => {
return null;
},
customSplitting,
root
);
}
if (strategy === "unbundle") {
return wrapCustomSplitConfig(
(id, { getModuleInfo }): string | undefined => {
if (id.includes("node_modules") && !isCSSIdentifier(id)) {
if (staticImportedScan(id, getModuleInfo, new Map(), [])) {
return "vendor";
} else {
return "async-vendor";
}
}
const cwd = process.cwd();
if (!id.includes("node_modules") && !isCSSIdentifier(id)) {
const extname = path.extname(id);
return normalizePath(path.relative(cwd, id).replace(extname, ""));
}
return;
},
{
...SPLIT_DEFAULT_MODULES,
...customSplitting,
},
root
);
}
return wrapCustomSplitConfig(
(id, { getModuleInfo }): string | undefined => {
if (id.includes("node_modules") && !isCSSIdentifier(id)) {
if (staticImportedScan(id, getModuleInfo, new Map(), [])) {
return "vendor";
}
}
},
{
...SPLIT_DEFAULT_MODULES,
...customSplitting,
},
root
);
};

@nathan-kerr
Copy link

nathan-kerr commented Oct 10, 2024

Yes, please. It is not clear how to decide which strategies to use in different scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants