186 | static _cleanModules(modules, pathToNodeModules) { |
187 | modules.forEach((p) => { |
188 | p.version = WebpackCdnPlugin.getVersionInNodeModules(p.name, pathToNodeModules); |
189 | |
190 | if (!p.paths) { |
191 | p.paths = []; |
192 | } |
193 | if (p.path) { |
194 | p.paths.unshift(p.path); |
195 | p.path = undefined; |
196 | } |
197 | if (p.paths.length === 0 && !p.cssOnly) { |
198 | p.paths.push( |
199 | require |
200 | .resolve(p.name) |
201 | .match(/[\\/]node_modules[\\/].+?[\\/](.*)/)[1] |
202 | .replace(/\\/g, '/'), |
203 | ); |
204 | } |
205 | |
206 | if (!p.styles) { |
207 | p.styles = []; |
208 | } |
209 | if (p.style) { |
210 | p.styles.unshift(p.style); |
211 | p.style = undefined; |
212 | } |
213 | }); |
214 | } |