Closed enten closed 7 years ago
Some amazing insights and advice here @enten - you are super helpful yet again. I really appreciate you taking the time to post this issue.
We could use something similar to how msbtr's react-boilerplate uses the DLL Plugin.
https://github.com/mxstbr/react-boilerplate/blob/master/internals/config.js https://github.com/mxstbr/react-boilerplate/blob/master/internals/webpack/webpack.dll.babel.js
Everything for the DLL's is pulled via what's in the package.json and additional includes that you manually add, such as core-js
My plan is to to tackle the aforementioned DLL modification today.
Awesome @strues - just saw this now. Looks like a great move!
Always up for anything that is simpler and/or less magical. :)
PoC is working. Allows both inclusion / exclusion. Also removes a lot of vendorDLL code.
Staged.
@ctrlplusb
I think we must enhance the dll's vendor by allowing to manually include modules.
The main purpose is to be able to manually add modules in the dll to reduce re-compilation times of the client bundle.
Context
I encountered huge re-compilation times caused by usage of
babel-polyfill
andreact-intl
(andintl
).The current modules detection (which will be passed to the DllPlugin) can't (and shouldn't) caught all imports which may be include in the dll.
So we need an option to manually add modules in the dll to reduce re-compilation times.
Proposal
I suggest a new
devVendorDLL
's option (inconfig/private/project.js
) calledincludes
.This option receive an array of files path patterns. These patterns will be resolved (only if it contains joker "*" char, else it's not a pattern but just a file path) and merge to modules paths in buildVendorDLL().
Use case example
In the example above:
fbjs
will not be resolved because it's not a file path patternintl/locale-data/jsonp/*.js
will be resolvedSo, the
includes
declarations above will be resolved into: