Created
May 7, 2018 13:29
-
-
Save popuguytheparrot/2f4b91feca057807551df7f99b6217c7 to your computer and use it in GitHub Desktop.
node_modules в vendor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
поясню: | |
1) Сначала выделяем все что используется более 3х раз в common асинхронный. | |
2) Из остатков экстрактим node_modules из всех дочерних чанков | |
3) Все пихаем в entry chunk | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'app', | |
async: 'common', | |
children: true, | |
deepChildren: true, | |
minChunks: (module, count) => { | |
return count >= 3 && module.context && !module.context.includes('node_modules'); | |
}, | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'app', | |
children: true, | |
deepChildren: true, | |
minChunks: (module) => { | |
if (module.resource && (/^.*\.(css|scss|sass)$/).test(module.resource)) { | |
return false; | |
} | |
return module.context && module.context.includes('node_modules'); | |
}, | |
}), | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
minChunks: (module) => { | |
if (module.resource && (/^.*\.(css|scss|sass)$/).test(module.resource)) { | |
return false; | |
} | |
return module.context && module.context.includes('node_modules'); | |
}, | |
}), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment