@@ -66,10 +66,38 @@ export const CleanClientModulesOnDLLTask = {
6666 // side code entries that were provided
6767 const serverDependencies = await getDependencies ( baseDir , serverEntries ) ;
6868
69+ // This fulfill a particular exceptional case where
70+ // we need to keep loading a file from a node_module
71+ // only used in the front-end like we do when using the file-loader
72+ // in https://github.com/elastic/kibana/blob/master/x-pack/legacy/plugins/maps/public/connected_components/map/mb/view.js
73+ //
74+ // manual list of exception modules
75+ const manualExceptionModules = [
76+ 'mapbox-gl'
77+ ] ;
78+
79+ // consider the top modules as exceptions as the entry points
80+ // to look for other exceptions dependent on that one
81+ const manualExceptionEntries = [
82+ ...manualExceptionModules . map ( module => `${ baseDir } /node_modules/${ module } ` )
83+ ] ;
84+
85+ // dependencies for declared exception modules
86+ const manualExceptionModulesDependencies = await getDependencies ( baseDir , [
87+ ...manualExceptionEntries
88+ ] ) ;
89+
90+ // final list of manual exceptions to add
91+ const manualExceptions = [
92+ ...manualExceptionModules ,
93+ ...manualExceptionModulesDependencies
94+ ] ;
95+
6996 // Consider this as our whiteList for the modules we can't delete
7097 const whiteListedModules = [
7198 ...serverDependencies ,
72- ...kbnWebpackLoaders
99+ ...kbnWebpackLoaders ,
100+ ...manualExceptions
73101 ] ;
74102
75103 // Resolve the client vendors dll manifest path
0 commit comments