-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Feature Use Case
// using object split chunk
{
output: {
manualChunks: {antd: ['antd']}
}
}
// using function split chunk
{
output: {
manualChunks: (id) => {
if(id.includes('antd')) return 'antd'
}
}using object split chunk
Why do we get inconsistent results?
Because module paths are resolved differently.
Using object for code splitting will get module paths, but Using function for code splitting will get a set of submodule paths that called 'ids'.
Using function for code splitting makes the split code unusable due to dependency issues.
So I need the 'id' to be the module path, or to provide an api to get the module path
manualChunks: (id, { resolve }) => {
if(id === resolve('antd')) return 'antd'
}
I couldn't get the module path because I didn't know which module resolution was used(eg: esm or cjs)
Feature Proposal
// first method
manualChunks: (id, { resolve }) => {
if(id === resolve('antd')) return 'antd'
}
// second method
manualChunks: (id) => {
// The id is a module path, not a submodule path
if(id.includes('antd')) return 'antd'
}
bfrickazhanglolo

