survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

4.3. Split app and vendors - adding vendors #17

Closed akatreyt closed 8 years ago

akatreyt commented 9 years ago

In the sample you have

vendors: ['react']

but no where in that sample page do you define react. On your site you define it as

config.addVendor('react', bower_dir + '/react/react.min.js');

so I expect it to be the same, if so also need to add the addVendor method.

christianalfoni commented 9 years ago

Hi @akatreyt , sorry for late reply, I have been sick with the flue. But up and running again now :-)

Thanks for asking this question, I will update with more information!

The reason is the webpack runs in Node and ['react'] basically means: require('react'). So the node module react is loaded. Does that make sense?

bebraw commented 9 years ago

@akatreyt Did you manage to resolve this?

bebraw commented 8 years ago

There's a chapter about splitting bundles now. Closing.